Stabilize pnpm verification fixture

This commit is contained in:
ejclaw
2026-05-16 18:55:56 +09:00
parent 7574953158
commit 84866279f8

View File

@@ -11,6 +11,7 @@ import {
runVerificationRequest,
} from './verification.js';
import {
buildWorkspaceCommandEnvironment,
ensureWorkspaceDependenciesInstalled,
hasInstalledNodeModules,
} from './workspace-package-manager.js';
@@ -106,7 +107,7 @@ describe('verification helpers', () => {
});
});
it('verifies nested pnpm workspaces under a bun parent without tripping corepack project specs', async () => {
it('builds nested pnpm verification commands without tripping corepack project specs', () => {
const parentDir = fs.mkdtempSync(
path.join(os.tmpdir(), 'ejclaw-verification-corepack-parent-'),
);
@@ -122,45 +123,31 @@ describe('verification helpers', () => {
JSON.stringify({
name: 'nested-pnpm-workspace',
scripts: {
typecheck:
'node -e "process.stdout.write(process.env.COREPACK_ENABLE_PROJECT_SPEC || \'missing\')"',
typecheck: 'tsc --noEmit',
},
}),
);
fs.writeFileSync(
path.join(repoDir, 'pnpm-lock.yaml'),
"lockfileVersion: '9.0'\n\n" +
'settings:\n' +
' autoInstallPeers: true\n' +
' excludeLinksFromLockfile: false\n\n' +
'importers:\n\n' +
' .: {}\n',
'lockfileVersion: 9.0\n',
);
fs.mkdirSync(path.join(repoDir, 'node_modules', '.bin'), {
recursive: true,
const command = buildVerificationCommand('typecheck', repoDir);
expect(command).toMatchObject({
file: 'corepack',
args: ['pnpm', 'run', 'typecheck'],
commandText: 'corepack pnpm run typecheck',
packageManager: 'pnpm',
requiredScript: 'typecheck',
});
expect(
buildWorkspaceCommandEnvironment(repoDir, command.packageManager, {
PATH: '/tmp/bin',
}),
).toMatchObject({
PATH: '/tmp/bin',
COREPACK_ENABLE_PROJECT_SPEC: '0',
});
fs.writeFileSync(
path.join(repoDir, 'node_modules', '.bin', 'placeholder'),
'',
);
expect(hasInstalledNodeModules(repoDir)).toBe(false);
const expectedSnapshotId = computeVerificationSnapshot(repoDir).snapshotId;
const result = await runVerificationRequest(
{
requestId: 'req-corepack-parent-pnpm',
profile: 'typecheck',
expectedSnapshotId,
},
{ repoDir },
);
expect(result.ok).toBe(true);
expect(result.exitCode).toBe(0);
expect(result.command).toBe('corepack pnpm run typecheck');
expect(result.stdout).toContain('0');
expect(result.snapshotId).toBe(expectedSnapshotId);
});
it('computes a stable snapshot over the readable workspace inputs', () => {