Backfill verification install state

This commit is contained in:
ejclaw
2026-04-08 01:35:34 +09:00
parent a90159e5d4
commit 92d499c779
4 changed files with 89 additions and 5 deletions

View File

@@ -181,4 +181,32 @@ describe('workspace package manager helpers', () => {
);
expect(hasInstalledNodeModules(repoDir)).toBe(false);
});
it('backfills install state for a legacy runnable node_modules tree', () => {
const repoDir = path.join(tempRoot, 'legacy');
fs.mkdirSync(path.join(repoDir, 'node_modules', '.bin'), {
recursive: true,
});
fs.writeFileSync(
path.join(repoDir, 'package.json'),
JSON.stringify({
name: 'legacy',
packageManager: 'bun@1.3.11',
scripts: { test: 'vitest run' },
}),
);
fs.writeFileSync(path.join(repoDir, 'bun.lock'), '');
fs.writeFileSync(path.join(repoDir, 'node_modules', '.bin', 'vitest'), '');
expect(hasInstalledNodeModules(repoDir)).toBe(false);
const result = ensureWorkspaceDependenciesInstalled(repoDir);
expect(result).toMatchObject({
installed: false,
packageManager: 'bun',
});
expect(hasInstalledNodeModules(repoDir)).toBe(true);
expect(execFileSyncMock).not.toHaveBeenCalled();
});
});