Files
vercel/packages/fs-detectors/test/unit.examples.test.ts
Nathan Rajlich abd1197c90 [fs-detectors] Fix "hydrogen-2" detection unit test (#10325)
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.
2023-08-10 21:25:51 +00:00

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);
}
);
});