From 635f19b2ca8a8a6726bc1b47953bed87ddec380c Mon Sep 17 00:00:00 2001 From: ehmicky Date: Sun, 27 Oct 2024 22:41:32 +0000 Subject: [PATCH] Fix Windows test --- test/terminate/kill-signal.js | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/test/terminate/kill-signal.js b/test/terminate/kill-signal.js index 1930ac9be1..26c500d2e5 100644 --- a/test/terminate/kill-signal.js +++ b/test/terminate/kill-signal.js @@ -1,16 +1,12 @@ import {once} from 'node:events'; -import {platform} from 'node:process'; import {constants} from 'node:os'; import {setImmediate} from 'node:timers/promises'; import test from 'ava'; import {execa, execaSync} from '../../index.js'; import {setFixtureDirectory} from '../helpers/fixtures-directory.js'; -import {majorNodeVersion} from '../helpers/node-version.js'; setFixtureDirectory(); -const isWindows = platform === 'win32'; - const testKillSignal = async (t, killSignal) => { const {isTerminated, signal} = await t.throwsAsync(execa('forever.js', {killSignal, timeout: 1})); t.true(isTerminated); @@ -61,21 +57,10 @@ test('Can call `.kill()` multiple times', async t => { subprocess.kill(); const {exitCode, isTerminated, signal, code} = await t.throwsAsync(subprocess); - - // On Windows, calling `subprocess.kill()` twice emits an `error` event on the subprocess. - // This does not happen when passing an `error` argument, nor when passing a non-terminating signal. - // There is no easy way to make this cross-platform, so we document the difference here. - if (isWindows && majorNodeVersion >= 22) { - t.is(exitCode, undefined); - t.false(isTerminated); - t.is(signal, undefined); - t.is(code, 'EPERM'); - } else { - t.is(exitCode, undefined); - t.true(isTerminated); - t.is(signal, 'SIGTERM'); - t.is(code, undefined); - } + t.is(exitCode, undefined); + t.true(isTerminated); + t.is(signal, 'SIGTERM'); + t.is(code, undefined); }); test('execa() returns a promise with kill()', async t => {