test(runtime): isolate artifact and browser bundling probes (CL26)
This commit is contained in:
parent
2a9382a201
commit
33e224048f
1 changed files with 17 additions and 8 deletions
|
|
@ -36,8 +36,13 @@ test('read-only custody cannot reach executable strategy loaders or a native add
|
|||
test('metadata imports work outside an installed checkout; artifact access fails only when requested', async () => {
|
||||
const directory = mkdtempSync(join(tmpdir(), 'stock-bot-metadata-import-'));
|
||||
try {
|
||||
const bundle = await Bun.build({ entrypoints: ['canonical-build', 'paper-host-identity', 'candidate-environment'].map(name => join(shared, name + '.ts')), target: 'bun', outdir: directory, external: ['@stock-bot/engine'] });
|
||||
expect(bundle.success).toBe(true);
|
||||
// Keep Bun's build/file-descriptor cache isolated from other in-process bundling tests.
|
||||
const build = Bun.spawnSync([process.execPath, '--no-env-file', '-e', `
|
||||
const result = await Bun.build(${JSON.stringify({ entrypoints: ['canonical-build', 'paper-host-identity', 'candidate-environment'].map(name => join(shared, name + '.ts')), target: 'bun', outdir: directory, external: ['@stock-bot/engine'] })});
|
||||
if (!result.success) { console.error(result.logs); process.exit(1); }
|
||||
`], { cwd: root, env: { PATH: process.env.PATH } });
|
||||
expect(new TextDecoder().decode(build.stderr)).toBe('');
|
||||
expect(build.exitCode).toBe(0);
|
||||
const child = Bun.spawnSync([process.execPath, '--no-env-file', '-e', `
|
||||
const { canonicalWorkerUrl } = await import('./canonical-build.js');
|
||||
await import('./paper-host-identity.js');
|
||||
|
|
@ -60,10 +65,14 @@ test('shared runtime dependencies participate in the actual Turbo build graph',
|
|||
}
|
||||
});
|
||||
|
||||
test('shared paper and product contracts bundle without server or native dependencies', async () => {
|
||||
const bundle = await Bun.build({ entrypoints: [join(root, 'apps/stock/config/src/contracts/paper-runtime.ts'), join(root, 'apps/stock/config/src/contracts/product-responses/index.ts')], target: 'browser' });
|
||||
expect(bundle.success).toBe(true);
|
||||
for (const output of bundle.outputs) {
|
||||
expect(await output.text()).not.toMatch(/PostgresClient|engine\.node|node:fs|node:child_process/);
|
||||
}
|
||||
test('shared paper and product contracts bundle without server or native dependencies', () => {
|
||||
const child = Bun.spawnSync([process.execPath, '--no-env-file', '-e', `
|
||||
const bundle = await Bun.build(${JSON.stringify({ entrypoints: [join(root, 'apps/stock/config/src/contracts/paper-runtime.ts'), join(root, 'apps/stock/config/src/contracts/product-responses/index.ts')], target: 'browser' })});
|
||||
if (!bundle.success) { console.error(bundle.logs); process.exit(1); }
|
||||
for (const output of bundle.outputs) {
|
||||
if (/PostgresClient|engine\\.node|node:fs|node:child_process/.test(await output.text())) process.exit(2);
|
||||
}
|
||||
`], { cwd: root, env: { PATH: process.env.PATH } });
|
||||
expect(new TextDecoder().decode(child.stderr)).toBe('');
|
||||
expect(child.exitCode).toBe(0);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue