test(packaging): cover spaced runtime imports

This commit is contained in:
Merge Sim
2026-09-06 00:56:27 -07:00
parent 1fe77cfa5a
commit adbb269dc1
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -238,7 +238,7 @@ function verifyPackagedMainRuntimeDeps(resourcesDir, asar = require('@electron/a
// backslashes, and extractFile expects that same host-style path.
const internalPath = entry.replace(/^[\\/]+/, '')
const source = asar.extractFile(asarPath, internalPath).toString('utf8')
for (const match of source.matchAll(/\b(?:require|import)\(\s*(["'`])([^"'`$]+)\1\s*\)/g)) {
for (const match of source.matchAll(/\b(?:require|import)\s*\(\s*(["'`])([^"'`$]+)\1\s*\)/g)) {
const specifier = match[2]
if (!isPackagedExternalSpecifier(specifier)) {
continue
@@ -50,7 +50,7 @@ describe('packaged runtime resources', () => {
await writeFile(join(resourcesDir, 'app.asar'), '', 'utf8')
const sources = new Map([
['out/main/index.js', 'import(`@anthropic-ai/claude-agent-sdk`)'],
['out/main/index.js', 'import (`@anthropic-ai/claude-agent-sdk`)'],
['out/main/agent-hooks/managed-agent-hook-controls.js', '']
])
const asar = {