The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): pin the chunk checker's bundle/harness verdict
teknium1a994f7e690e9
diff --git a/tests-js/renderer-syntax-node.test.mjs b/tests-js/renderer-syntax-node.test.mjsindex be781b9e92d..fa194739b33 100644--- a/tests-js/renderer-syntax-node.test.mjs+++ b/tests-js/renderer-syntax-node.test.mjs@@ -1,10 +1,12 @@-import { execFileSync } from 'node:child_process'+import { execFileSync, spawnSync } from 'node:child_process'import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'import { tmpdir } from 'node:os'import { join } from 'node:path'+import { fileURLToPath } from 'node:url'import { expect, test } from 'vitest'const checker = new URL('../apps/desktop/scripts/assert-dist-built.mjs', import.meta.url).href+const parser = fileURLToPath(new URL('../apps/desktop/scripts/check-chunks-parse.mjs', import.meta.url))test('renderer syntax checks use the running Node without PATH and preserve explicit NODE', () => {const root = mkdtempSync(join(tmpdir(), 'renderer check with spaces-'))@@ -23,10 +25,13 @@ test('renderer syntax checks use the running Node without PATH and preserve explwriteFileSync(asset, 'export const value = 1; throw new Error("do not execute")')expect(check()).toEqual({ ok: true })expect(check(process.execPath)).toEqual({ ok: true })+ // Without the VM module API the CHECK failed, not the bundle: never blame a valid chunk.+ const noVm = spawnSync(process.execPath, [parser, join(root, 'assets')], { encoding: 'utf8' })+ expect(JSON.parse(noVm.stdout.trim().split('\n').at(-1))).toMatchObject({ ok: false, kind: 'harness' })writeFileSync(asset, 'export const = ;')- expect(check()).toMatchObject({ ok: false, error: expect.stringContaining('not valid ES module syntax') })+ expect(check()).toMatchObject({ ok: false, kind: 'bundle', error: expect.stringContaining('not valid ES module syntax') })const missingNode = join(root, 'missing-node')- expect(check(missingNode)).toMatchObject({ ok: false, error: expect.stringContaining('could not run node') })+ expect(check(missingNode)).toMatchObject({ ok: false, kind: 'harness', error: expect.stringContaining('could not run node') })} finally {rmSync(root, { recursive: true, force: true })}