Stabilize pnpm verification fixture
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
runVerificationRequest,
|
runVerificationRequest,
|
||||||
} from './verification.js';
|
} from './verification.js';
|
||||||
import {
|
import {
|
||||||
|
buildWorkspaceCommandEnvironment,
|
||||||
ensureWorkspaceDependenciesInstalled,
|
ensureWorkspaceDependenciesInstalled,
|
||||||
hasInstalledNodeModules,
|
hasInstalledNodeModules,
|
||||||
} from './workspace-package-manager.js';
|
} 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(
|
const parentDir = fs.mkdtempSync(
|
||||||
path.join(os.tmpdir(), 'ejclaw-verification-corepack-parent-'),
|
path.join(os.tmpdir(), 'ejclaw-verification-corepack-parent-'),
|
||||||
);
|
);
|
||||||
@@ -122,45 +123,31 @@ describe('verification helpers', () => {
|
|||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
name: 'nested-pnpm-workspace',
|
name: 'nested-pnpm-workspace',
|
||||||
scripts: {
|
scripts: {
|
||||||
typecheck:
|
typecheck: 'tsc --noEmit',
|
||||||
'node -e "process.stdout.write(process.env.COREPACK_ENABLE_PROJECT_SPEC || \'missing\')"',
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.join(repoDir, 'pnpm-lock.yaml'),
|
path.join(repoDir, 'pnpm-lock.yaml'),
|
||||||
"lockfileVersion: '9.0'\n\n" +
|
'lockfileVersion: 9.0\n',
|
||||||
'settings:\n' +
|
|
||||||
' autoInstallPeers: true\n' +
|
|
||||||
' excludeLinksFromLockfile: false\n\n' +
|
|
||||||
'importers:\n\n' +
|
|
||||||
' .: {}\n',
|
|
||||||
);
|
);
|
||||||
fs.mkdirSync(path.join(repoDir, 'node_modules', '.bin'), {
|
const command = buildVerificationCommand('typecheck', repoDir);
|
||||||
recursive: true,
|
|
||||||
|
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', () => {
|
it('computes a stable snapshot over the readable workspace inputs', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user