mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 04:22:01 +00:00
Follow-up to https://github.com/vercel/vercel/pull/10319, which didn't exhibit this failing test since the fs-detectors package was not changed, and thus those tests didn't run.
27 lines
890 B
TypeScript
Vendored
27 lines
890 B
TypeScript
Vendored
import frameworkList from '@vercel/frameworks';
|
|
import { detectFramework, LocalFileSystemDetector } from '../src';
|
|
import { getExamples } from '../../../examples/__tests__/test-utils';
|
|
|
|
const overrides = new Map([
|
|
// Storybook isn't really a "framework".
|
|
// In this example, it's really a Next.js app.
|
|
['storybook', 'nextjs'],
|
|
// Hydrogen v2 uses Remix under the hood.
|
|
['hydrogen-2', 'remix'],
|
|
]);
|
|
|
|
describe('examples should be detected', () => {
|
|
it.each(getExamples())(
|
|
'should detect $exampleName',
|
|
async ({ exampleName, examplePath }) => {
|
|
const fs = new LocalFileSystemDetector(examplePath);
|
|
const framework = await detectFramework({ fs, frameworkList });
|
|
if (!framework) {
|
|
throw new Error(`Framework not detected for example "${exampleName}".`);
|
|
}
|
|
|
|
expect(framework).toBe(overrides.get(framework) ?? framework);
|
|
}
|
|
);
|
|
});
|