import fs from 'node:fs'; import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import { createHash } from 'node:crypto'; const generator = fs.readFileSync('.qa/embedded-browser-d-prepare-installer.mjs', 'utf8'); const start = generator.indexOf('let code = fs.readFileSync('); const end = generator.indexOf("\nfs.writeFileSync('.qa/verify-embedded-browser-d-install.mjs'", start); assert.ok(start > 0 && end > start); const code = new Function('fs', 'appId', 'assert', generator.slice(start, end) + '\nreturn code;')(fs, '00000000-0000-4000-8000-000000000022', assert); const destination = '.qa/embedded-browser-d-install-dryrun.mjs'; fs.writeFileSync(destination, code, { flag: 'wx' }); execFileSync(process.execPath, ['--check', destination], { stdio: 'pipe', windowsHide: true }); assert.ok(code.includes('embeddedBrowser: {groups:browserProof.checks.length')); assert.ok(code.includes("path.join(browserProof.root,'result.json')")); const receipt = { success: true, scope: 'Pure string generation and syntax only; no installer built or executed', destination, sha256: createHash('sha256').update(code).digest('hex') }; fs.writeFileSync('.qa/embedded-browser-d-install-syntax-check.json', JSON.stringify(receipt, null, 2) + '\n', { flag: 'wx' }); console.log(JSON.stringify(receipt));