Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/codemod/test/v1-to-v2/packageJsonUpdater.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,16 @@ describe('run() manifest integration', () => {
"import { Client } from '@modelcontextprotocol/sdk/client/index.js';\nexport { Client };\n"
);
// A cycle: src/loop -> the project root.
symlinkSync(dir, path.join(dir, 'src', 'loop'), 'dir');
// Creating a 'dir' symlink on Windows requires admin rights or
// Developer Mode; a junction does not and still forms the cycle.
symlinkSync(dir, path.join(dir, 'src', 'loop'), process.platform === 'win32' ? 'junction' : 'dir');

const result = run(v1ToV2Migration, { targetDir: dir, dryRun: false });

// The symlinked re-entry must not be followed: exactly one source file seen.
// (If the guard ever regressed, a manual mutation run on Windows would report 64
// entries here — 63 resolvable reparse-point levels plus the one that fails — and
// a second nested junction would halve the count to 32.)
expect(result.fileResults.map(fr => fr.filePath)).toHaveLength(1);
expect(result.packageJsonChanges?.[0]?.applied).toBe(true);
expect(result.packageJsonChanges?.[0]?.removed).toEqual(['@modelcontextprotocol/sdk']);
Expand Down
Loading