test(desktop): match the desktop.mjs compile step with native path separators

The --icons case found the compile command with endsWith('/scripts/build/desktop.mjs'),
which never matches the path.join-built argument on Windows, so the case failed with
TypeError instead of asserting. Match both separator styles.

Fixes https://github.com/NousResearch/hermes-agent/issues/125139
This commit is contained in:
Brooklyn Nicholson
2026-09-27 07:02:22 -05:00
committed by brooklyn!
parent 062dc1e7f0
commit 8bcca88282

View File

@@ -18,7 +18,8 @@ test('desktop development composition reuses prepared icon pixels instead of pro
run: (command, args) => commands.push([command, ...args]), run: (command, args) => commands.push([command, ...args]),
}) })
expect(readFileSync(join(input.source, 'apps/desktop/assets/icon.ico'), 'utf8')).toBe('prepared packaging icon') expect(readFileSync(join(input.source, 'apps/desktop/assets/icon.ico'), 'utf8')).toBe('prepared packaging icon')
const compile = commands.find(command => command.some(arg => arg.endsWith('/scripts/build/desktop.mjs'))) // path.join builds platform-native separators, so accept both `/` and `\`.
const compile = commands.find(command => command.some(arg => /[/\\]scripts[/\\]build[/\\]desktop\.mjs$/.test(arg)))
expect(compile[compile.indexOf('--icons') + 1]).toBe(input.icons) expect(compile[compile.indexOf('--icons') + 1]).toBe(input.icons)
}) })
afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }) }) afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }) })