mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
The code for these two are almost identical, so consolidate into one codebase. Also adjusts the `pnpm test` script to allow for specifying a file name to be executed, instead of running all tests.
31 lines
1007 B
TypeScript
Vendored
31 lines
1007 B
TypeScript
Vendored
import path from 'path';
|
|
import { LocalFileSystemDetector } from '../src';
|
|
import { detectFramework } from '../src/detect-framework';
|
|
import monorepoManagers from '../src/monorepos/monorepo-managers';
|
|
|
|
describe('monorepo-managers', () => {
|
|
describe.each([
|
|
['28-turborepo-with-yarn-workspaces', 'turbo'],
|
|
['31-turborepo-in-package-json', 'turbo'],
|
|
['22-pnpm', null],
|
|
['39-nx-monorepo', 'nx'],
|
|
['40-rush-monorepo', 'rush'],
|
|
])('with detectFramework', (fixturePath, frameworkSlug) => {
|
|
const testName = frameworkSlug
|
|
? `should detect a ${frameworkSlug} workspace for ${fixturePath}`
|
|
: `should not detect a monorepo manager for ${fixturePath}`;
|
|
|
|
it(testName, async () => {
|
|
const fixture = path.join(__dirname, 'fixtures', fixturePath);
|
|
const fs = new LocalFileSystemDetector(fixture);
|
|
|
|
const result = await detectFramework({
|
|
fs,
|
|
frameworkList: monorepoManagers,
|
|
});
|
|
|
|
expect(result).toBe(frameworkSlug);
|
|
});
|
|
});
|
|
});
|