mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 12:57:46 +00:00
These tests will run if one of the conditions is met: - any change to `./examples` - any changes to `./packages/frameworks` The test ensures that examples can build and deploy without errors. In a future PR, we could improve these tests to make requests to the test deployment (like we do for probes).
27 lines
761 B
TypeScript
27 lines
761 B
TypeScript
import { existsSync, lstatSync, readdirSync } from 'fs';
|
|
import { join } from 'path';
|
|
|
|
function getExamples() {
|
|
const dirname = join(__dirname, '..', '..');
|
|
const examples = readdirSync(dirname)
|
|
.map(example =>
|
|
({
|
|
exampleName: example,
|
|
examplePath: join(dirname, example),
|
|
testPath: join(dirname, '__tests__', 'integration', `${example}.test.ts`),
|
|
})
|
|
)
|
|
.filter(o =>
|
|
!o.exampleName.startsWith('.') &&
|
|
!o.exampleName.startsWith('_') &&
|
|
lstatSync(o.examplePath).isDirectory()
|
|
);
|
|
return examples;
|
|
}
|
|
|
|
describe('should have test for each example', () => {
|
|
it.each(getExamples())('should exist $exampleName', async ({testPath}) => {
|
|
expect(existsSync(testPath)).toBeTruthy();
|
|
});
|
|
});
|