Parcourir la source

test(subprocess): align native platform fixtures

pku-xht il y a 1 mois
Parent
commit
f6a56d4882

+ 1 - 1
packages/subprocess/subprocess-local/tests/linux-scope.spec.ts

@@ -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[]) => {

+ 6 - 6
packages/subprocess/subprocess-local/tests/native-windows.spec.ts

@@ -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' })
   })
 })