test(subprocess): align native platform fixtures

This commit is contained in:
pku-xht committed 2026-08-20 22:41:03 +08:00
1 parent b25e790e36
commit f6a56d4882
2 files changed
+7 -7

No files matched your search

@@ -14,7 +14,7 @@ function spec(argv: string[]): SubprocessSpawnSpec {
}
}
describe('Linux systemd scope adapter', () => {
describe.skipIf(process.platform === 'win32')('Linux systemd scope adapter', () => {
it('requires a readable user manager and literal-argument systemd support', () => {
const calls: string[][] = []
const runSync = vi.fn((command: string, args: readonly string[]) => {
@@ -111,15 +111,15 @@ describe.skipIf(!windowsNative)('Windows Job native containment', () => {
}
})
it('preserves missing-target and direct cmd rejection errors', async () => {
it('preserves missing-target and invalid-executable rejection errors', async () => {
const missing = spec([`missing-native-target-${Date.now()}.exe`])
const missingHandle = bindManagedProcess(missing, launchWindowsJob(missing))
await expect(missingHandle.done).rejects.toMatchObject({ code: 'ENOENT' })
const cmd = join(scratch, `direct-${Date.now()}.cmd`)
writeFileSync(cmd, '@exit /b 0\r\n')
const directCmd = spec([cmd])
const cmdHandle = bindManagedProcess(directCmd, launchWindowsJob(directCmd))
await expect(cmdHandle.done).rejects.toMatchObject({ code: 'EINVAL' })
const invalidExecutable = join(scratch, `direct-${Date.now()}.exe`)
writeFileSync(invalidExecutable, 'not a Windows executable\r\n')
const invalid = spec([invalidExecutable])
const invalidHandle = bindManagedProcess(invalid, launchWindowsJob(invalid))
await expect(invalidHandle.done).rejects.toMatchObject({ code: 'EINVAL' })
})
})