kill.js
This file
Path
test/kill.js
345 lines · 13.1 KiB · JavaScript
Last changed by
Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
History of this fileTake it
The walk stopped after 200 commits: lines older than 31ac967 point at it.
Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 1why, one step back1import process from 'node:process';Improve process termination (#724)ehmickybefore adoption1c48d37
line 2why, one step back2import {once} from 'node:events';Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
line 3why, one step back3import {constants} from 'node:os';Fix test about `SIGTERM` (#611)ehmickybefore adoption85a9821
line 4why, one step back4import {setTimeout} from 'node:timers/promises';Add `serialization` option (#392)ehmickybefore adoption31ac967
line 5why, one step back5import test from 'ava';Minor tweaksSindre Sorhusbefore adoption244e87a
line 6why, one step back6import {pEvent} from 'p-event';Add `serialization` option (#392)ehmickybefore adoption31ac967
line 7why, one step back7import isRunning from 'is-running';Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 8why, one step back8import {execa, execaSync} from '../index.js';Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2
line 9why, one step back9import {setFixtureDir} from './helpers/fixtures-dir.js';Add `serialization` option (#392)ehmickybefore adoption31ac967
line 10why, one step back10Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2
line 11why, one step back11setFixtureDir();Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 12–14why, one step back1213const TIMEOUT_REGEXP = /timed out after/;14Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
line 15why, one step back15const spawnNoKillable = async (forceKillAfterDelay, options) => {Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 16–17why, one step back16 const subprocess = execa('no-killable.js', {17 stdio: ['pipe', 'pipe', 'pipe', 'ipc'],Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
line 18why, one step back18 forceKillAfterDelay,Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 19–20why, one step back19 ...options,20 });Add `serialization` option (#392)ehmickybefore adoption31ac967
line 21why, one step back21 await pEvent(subprocess, 'message');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 22–23why, one step back22 return {subprocess};23};Add `serialization` option (#392)ehmickybefore adoption31ac967
line 24why, one step back24Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 25–27why, one step back25test('kill("SIGKILL") should terminate cleanly', async t => {26 const {subprocess} = await spawnNoKillable();27Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 28–29why, one step back28 subprocess.kill('SIGKILL');29Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 30–31why, one step back30 const {isTerminated, signal} = await t.throwsAsync(subprocess);31 t.true(isTerminated);Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 32–37why, one step back32 t.is(signal, 'SIGKILL');33});3435// `SIGTERM` cannot be caught on Windows, and it always aborts the process (like `SIGKILL` on Unix).36// Therefore, this feature and those tests do not make sense on Windows.37if (process.platform !== 'win32') {Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 38–39why, one step back38 const testNoForceKill = async (t, forceKillAfterDelay, killArgument, options) => {39 const {subprocess} = await spawnNoKillable(forceKillAfterDelay, options);Add `serialization` option (#392)ehmickybefore adoption31ac967
line 40why, one step back40Improve graceful exit (#714)ehmickybefore adoption5eeaab5
line 41why, one step back41 subprocess.kill(killArgument);Add `serialization` option (#392)ehmickybefore adoption31ac967
line 42why, one step back42Improve graceful exit (#714)ehmickybefore adoption5eeaab5
line 43why, one step back43 await setTimeout(6e3);Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 44–46why, one step back44 t.true(isRunning(subprocess.pid));45 subprocess.kill('SIGKILL');46Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 47–48why, one step back47 const {isTerminated, signal} = await t.throwsAsync(subprocess);48 t.true(isTerminated);Add `serialization` option (#392)ehmickybefore adoption31ac967
line 49why, one step back49 t.is(signal, 'SIGKILL');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
line 50why, one step back50 };Add `serialization` option (#392)ehmickybefore adoption31ac967
line 51why, one step back51Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
lines 52–53why, one step back52 test('`forceKillAfterDelay: false` should not kill after a timeout', testNoForceKill, false);53 test('`forceKillAfterDelay` should not kill after a timeout with other signals', testNoForceKill, true, 'SIGINT');Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 54–55why, one step back54 test('`forceKillAfterDelay` should not kill after a timeout with wrong killSignal string', testNoForceKill, true, 'SIGTERM', {killSignal: 'SIGINT'});55 test('`forceKillAfterDelay` should not kill after a timeout with wrong killSignal number', testNoForceKill, true, constants.signals.SIGTERM, {killSignal: constants.signals.SIGINT});Add `serialization` option (#392)ehmickybefore adoption31ac967
line 56why, one step back56Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 57–58why, one step back57 const testForceKill = async (t, forceKillAfterDelay, killArgument, options) => {58 const {subprocess} = await spawnNoKillable(forceKillAfterDelay, options);Add `serialization` option (#392)ehmickybefore adoption31ac967
line 59why, one step back59Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 60–63why, one step back60 subprocess.kill(killArgument);6162 const {isTerminated, signal} = await t.throwsAsync(subprocess);63 t.true(isTerminated);Add `serialization` option (#392)ehmickybefore adoption31ac967
line 64why, one step back64 t.is(signal, 'SIGKILL');Improve some tests (#655)ehmickybefore adoption6cf1c5e
line 65why, one step back65 };Add `serialization` option (#392)ehmickybefore adoption31ac967
line 66why, one step back66Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
lines 67–69why, one step back67 test('`forceKillAfterDelay: number` should kill after a timeout', testForceKill, 50);68 test('`forceKillAfterDelay: true` should kill after a timeout', testForceKill, true);69 test('`forceKillAfterDelay: undefined` should kill after a timeout', testForceKill, undefined);Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 70–72why, one step back70 test('`forceKillAfterDelay` should kill after a timeout with SIGTERM', testForceKill, 50, 'SIGTERM');71 test('`forceKillAfterDelay` should kill after a timeout with the killSignal string', testForceKill, 50, 'SIGINT', {killSignal: 'SIGINT'});72 test('`forceKillAfterDelay` should kill after a timeout with the killSignal number', testForceKill, 50, constants.signals.SIGINT, {killSignal: constants.signals.SIGINT});Add `serialization` option (#392)ehmickybefore adoption31ac967
line 73why, one step back73Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
line 74why, one step back74 const testInvalidForceKill = async (t, forceKillAfterDelay) => {Add `serialization` option (#392)ehmickybefore adoption31ac967
line 75why, one step back75 t.throws(() => {Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
line 76why, one step back76 execa('empty.js', {forceKillAfterDelay});Add `serialization` option (#392)ehmickybefore adoption31ac967
line 77why, one step back77 }, {instanceOf: TypeError, message: /non-negative integer/});Improve some tests (#655)ehmickybefore adoption6cf1c5e
line 78why, one step back78 };Add `serialization` option (#392)ehmickybefore adoption31ac967
line 79why, one step back79Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
lines 80–81why, one step back80 test('`forceKillAfterDelay` should not be NaN', testInvalidForceKill, Number.NaN);81 test('`forceKillAfterDelay` should not be negative', testInvalidForceKill, -1);Improve graceful exit (#714)ehmickybefore adoption5eeaab5
line 82why, one step back82Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
line 83why, one step back83 test('`forceKillAfterDelay` works with the "signal" option', async t => {Improve graceful exit (#714)ehmickybefore adoption5eeaab5
line 84why, one step back84 const abortController = new AbortController();Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 85–86why, one step back85 const subprocess = execa('forever.js', {killSignal: 'SIGWINCH', forceKillAfterDelay: 1, signal: abortController.signal});86 await once(subprocess, 'spawn');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 87–88why, one step back87 abortController.abort();88 const {isTerminated, signal, isCanceled} = await t.throwsAsync(subprocess);Improve process termination (#724)ehmickybefore adoption1c48d37
lines 89–90why, one step back89 t.true(isTerminated);90 t.is(signal, 'SIGKILL');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 91–93why, one step back91 t.true(isCanceled);92 });93Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 94–95why, one step back94 test('`forceKillAfterDelay` works with the "timeout" option', async t => {95 const subprocess = execa('forever.js', {killSignal: 'SIGWINCH', forceKillAfterDelay: 1, timeout: 1});Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 96–97why, one step back96 const {isTerminated, signal, timedOut} = await t.throwsAsync(subprocess);97 t.true(isTerminated);Improve process termination (#724)ehmickybefore adoption1c48d37
line 98why, one step back98 t.is(signal, 'SIGKILL');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 99–101why, one step back99 t.true(timedOut);100 });101Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
line 102why, one step back102 test('`forceKillAfterDelay` works with the "maxBuffer" option', async t => {Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
line 103why, one step back103 const subprocess = execa('noop-forever.js', ['.'], {killSignal: 'SIGWINCH', forceKillAfterDelay: 1, maxBuffer: 1});Improve graceful exit (#714)ehmickybefore adoption5eeaab5
line 104why, one step back104 const {isTerminated, signal} = await t.throwsAsync(subprocess);Improve process termination (#724)ehmickybefore adoption1c48d37
lines 105–106why, one step back105 t.true(isTerminated);106 t.is(signal, 'SIGKILL');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 107–108why, one step back107 });108Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
line 109why, one step back109 test('`forceKillAfterDelay` works with "error" events on childProcess', async t => {Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 110–111why, one step back110 const subprocess = execa('forever.js', {killSignal: 'SIGWINCH', forceKillAfterDelay: 1});111 await once(subprocess, 'spawn');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 112–113why, one step back112 subprocess.emit('error', new Error('test'));113 const {isTerminated, signal} = await t.throwsAsync(subprocess);Improve process termination (#724)ehmickybefore adoption1c48d37
lines 114–115why, one step back114 t.true(isTerminated);115 t.is(signal, 'SIGKILL');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 116–117why, one step back116 });117Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34
line 118why, one step back118 test('`forceKillAfterDelay` works with "error" events on childProcess.stdout', async t => {Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 119–120why, one step back119 const subprocess = execa('forever.js', {killSignal: 'SIGWINCH', forceKillAfterDelay: 1});120 await once(subprocess, 'spawn');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
lines 121–122why, one step back121 subprocess.stdout.destroy(new Error('test'));122 const {isTerminated, signal} = await t.throwsAsync(subprocess);Improve process termination (#724)ehmickybefore adoption1c48d37
lines 123–124why, one step back123 t.true(isTerminated);124 t.is(signal, 'SIGKILL');Improve graceful exit (#714)ehmickybefore adoption5eeaab5
line 125why, one step back125 });Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 126–127why, one step back126}127Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
lines 128–131why, one step back128test('execa() returns a promise with kill()', async t => {129 const subprocess = execa('noop.js', ['foo']);130 t.is(typeof subprocess.kill, 'function');131 await subprocess;Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 132–134why, one step back132});133134test('timeout kills the process if it times out', async t => {Improve `timeout` option validation (#715)ehmickybefore adoption0fbd3a2
line 135why, one step back135 const {isTerminated, signal, timedOut} = await t.throwsAsync(execa('forever.js', {timeout: 1}), {message: TIMEOUT_REGEXP});Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c
line 136why, one step back136 t.true(isTerminated);Improve `timeout` option validation (#715)ehmickybefore adoption0fbd3a2
line 137why, one step back137 t.is(signal, 'SIGTERM');Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 138–141why, one step back138 t.true(timedOut);139});140141test('timeout kills the process if it times out, in sync mode', async t => {Improve `timeout` option validation (#715)ehmickybefore adoption0fbd3a2
lines 142–143why, one step back142 const {isTerminated, signal, timedOut} = await t.throws(() => {143 execaSync('forever.js', {timeout: 1, message: TIMEOUT_REGEXP});Add `serialization` option (#392)ehmickybefore adoption31ac967
line 144why, one step back144 });Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c
line 145why, one step back145 t.true(isTerminated);Improve `timeout` option validation (#715)ehmickybefore adoption0fbd3a2
line 146why, one step back146 t.is(signal, 'SIGTERM');Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 147–150why, one step back147 t.true(timedOut);148});149150test('timeout does not kill the process if it does not time out', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 151why, one step back151 const {timedOut} = await execa('delay.js', ['500'], {timeout: 1e8});Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 152–154why, one step back152 t.false(timedOut);153});154Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 155–161why, one step back155test('timeout uses killSignal', async t => {156 const {isTerminated, signal, timedOut} = await t.throwsAsync(execa('forever.js', {timeout: 1, killSignal: 'SIGINT'}));157 t.true(isTerminated);158 t.is(signal, 'SIGINT');159 t.true(timedOut);160});161Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 162–163why, one step back162const INVALID_TIMEOUT_REGEXP = /`timeout` option to be a non-negative integer/;163Improve `timeout` option validation (#715)ehmickybefore adoption0fbd3a2
lines 164–166why, one step back164const testTimeoutValidation = (t, timeout, execaMethod) => {165 t.throws(() => {166 execaMethod('empty.js', {timeout});Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 167why, one step back167 }, {message: INVALID_TIMEOUT_REGEXP});Improve `timeout` option validation (#715)ehmickybefore adoption0fbd3a2
line 168why, one step back168};Add `serialization` option (#392)ehmickybefore adoption31ac967
line 169why, one step back169Improve `timeout` option validation (#715)ehmickybefore adoption0fbd3a2
lines 170–173why, one step back170test('timeout must not be negative', testTimeoutValidation, -1, execa);171test('timeout must be an integer', testTimeoutValidation, false, execa);172test('timeout must not be negative - sync', testTimeoutValidation, -1, execaSync);173test('timeout must be an integer - sync', testTimeoutValidation, false, execaSync);Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 174–175why, one step back174175test('timedOut is false if timeout is undefined', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 176why, one step back176 const {timedOut} = await execa('noop.js');Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 177–180why, one step back177 t.false(timedOut);178});179180test('timedOut is false if timeout is 0', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 181why, one step back181 const {timedOut} = await execa('noop.js', {timeout: 0});Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 182–185why, one step back182 t.false(timedOut);183});184185test('timedOut is false if timeout is undefined and exit code is 0 in sync mode', t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 186why, one step back186 const {timedOut} = execaSync('noop.js');Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 187–191why, one step back187 t.false(timedOut);188});189190// When child process exits before parent process191const spawnAndExit = async (t, cleanup, detached) => {Fix randomly failing test (#725)ehmickybefore adoption1fbf484
line 192why, one step back192 await t.notThrowsAsync(execa('nested.js', [JSON.stringify({cleanup, detached}), 'noop.js']));Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 193–200why, one step back193};194195test('spawnAndExit', spawnAndExit, false, false);196test('spawnAndExit cleanup', spawnAndExit, true, false);197test('spawnAndExit detached', spawnAndExit, false, true);198test('spawnAndExit cleanup detached', spawnAndExit, true, true);199200// When parent process exits before child processFix linting errors (#462)ehmickybefore adoption8e4f901
line 201why, one step back201const spawnAndKill = async (t, [signal, cleanup, detached, isKilled]) => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 202why, one step back202 const subprocess = execa('sub-process.js', [cleanup, detached], {stdio: ['ignore', 'ignore', 'ignore', 'ipc']});Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 203–212why, one step back203204 const pid = await pEvent(subprocess, 'message');205 t.true(Number.isInteger(pid));206 t.true(isRunning(pid));207208 process.kill(subprocess.pid, signal);209210 await t.throwsAsync(subprocess);211 t.false(isRunning(subprocess.pid));212Fix randomly failing test (#725)ehmickybefore adoption1fbf484
lines 213–220why, one step back213 if (isKilled) {214 await Promise.race([215 setTimeout(1e4, undefined, {ref: false}),216 pollForProcessExit(pid),217 ]);218 t.is(isRunning(pid), false);219 } else {220 t.is(isRunning(pid), true);Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 221–224why, one step back221 process.kill(pid, 'SIGKILL');222 }223};224Fix randomly failing test (#725)ehmickybefore adoption1fbf484
lines 225–231why, one step back225const pollForProcessExit = async pid => {226 while (isRunning(pid)) {227 // eslint-disable-next-line no-await-in-loop228 await setTimeout(100);229 }230};231Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 232–238why, one step back232// Without `options.cleanup`:233// - on Windows subprocesses are killed if `options.detached: false`, but not234// if `options.detached: true`235// - on Linux subprocesses are never killed regardless of `options.detached`236// With `options.cleanup`, subprocesses are always killed237// - `options.cleanup` with SIGKILL is a noop, since it cannot be handled238const exitIfWindows = process.platform === 'win32';Fix linting errors (#462)ehmickybefore adoption8e4f901
lines 239–240why, one step back239test('spawnAndKill SIGTERM', spawnAndKill, ['SIGTERM', false, false, exitIfWindows]);240test('spawnAndKill SIGKILL', spawnAndKill, ['SIGKILL', false, false, exitIfWindows]);Fix randomly failing test (#725)ehmickybefore adoption1fbf484
line 241why, one step back241test('spawnAndKill cleanup SIGTERM', spawnAndKill, ['SIGTERM', true, false, true]);Fix linting errors (#462)ehmickybefore adoption8e4f901
lines 242–246why, one step back242test('spawnAndKill cleanup SIGKILL', spawnAndKill, ['SIGKILL', true, false, exitIfWindows]);243test('spawnAndKill detached SIGTERM', spawnAndKill, ['SIGTERM', false, true, false]);244test('spawnAndKill detached SIGKILL', spawnAndKill, ['SIGKILL', false, true, false]);245test('spawnAndKill cleanup detached SIGTERM', spawnAndKill, ['SIGTERM', true, true, false]);246test('spawnAndKill cleanup detached SIGKILL', spawnAndKill, ['SIGKILL', true, true, false]);Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 247–249why, one step back247248// See #128249test('removes exit handler on exit', async t => {Fix linting errors (#462)ehmickybefore adoption8e4f901
line 250why, one step back250 // @todo this relies on `signal-exit` internalsRefactor `timeout` option to use `async/await` (#650)ehmickybefore adoption76ff50b
line 251why, one step back251 const exitListeners = globalThis[Symbol.for('signal-exit emitter')].listeners.exit;Add `serialization` option (#392)ehmickybefore adoption31ac967
line 252why, one step back252Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 253why, one step back253 const subprocess = execa('noop.js');Refactor `timeout` option to use `async/await` (#650)ehmickybefore adoption76ff50b
line 254why, one step back254 const listener = exitListeners.at(-1);Add `serialization` option (#392)ehmickybefore adoption31ac967
line 255why, one step back255Refactor `timeout` option to use `async/await` (#650)ehmickybefore adoption76ff50b
lines 256–257why, one step back256 await subprocess;257 t.false(exitListeners.includes(listener));Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 258–259why, one step back258});259Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
line 260why, one step back260test('result.isCanceled is false when abort isn\'t called (success)', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 261why, one step back261 const {isCanceled} = await execa('noop.js');Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 262–264why, one step back262 t.false(isCanceled);263});264Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
line 265why, one step back265test('result.isCanceled is false when abort isn\'t called (failure)', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 266why, one step back266 const {isCanceled} = await t.throwsAsync(execa('fail.js'));Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 267–269why, one step back267 t.false(isCanceled);268});269Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
line 270why, one step back270test('result.isCanceled is false when abort isn\'t called in sync mode (success)', t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 271why, one step back271 const {isCanceled} = execaSync('noop.js');Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 272–274why, one step back272 t.false(isCanceled);273});274Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
line 275why, one step back275test('result.isCanceled is false when abort isn\'t called in sync mode (failure)', t => {Add `serialization` option (#392)ehmickybefore adoption31ac967
line 276why, one step back276 const {isCanceled} = t.throws(() => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 277why, one step back277 execaSync('fail.js');Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 278–281why, one step back278 });279 t.false(isCanceled);280});281Improve process termination (#724)ehmickybefore adoption1c48d37
line 282why, one step back282test('calling abort is considered a signal termination', async t => {Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
line 283why, one step back283 const abortController = new AbortController();Improve process termination (#724)ehmickybefore adoption1c48d37
lines 284–285why, one step back284 const subprocess = execa('forever.js', {signal: abortController.signal});285 await once(subprocess, 'spawn');Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
lines 286–287why, one step back286 abortController.abort();287 const {isTerminated, signal} = await t.throwsAsync(subprocess);Improve process termination (#724)ehmickybefore adoption1c48d37
lines 288–289why, one step back288 t.true(isTerminated);289 t.is(signal, 'SIGTERM');Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 290–291why, one step back290});291Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
lines 292–295why, one step back292test('error.isCanceled is true when abort is used', async t => {293 const abortController = new AbortController();294 const subprocess = execa('noop.js', {signal: abortController.signal});295 abortController.abort();Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 296–300why, one step back296 const {isCanceled} = await t.throwsAsync(subprocess);297 t.true(isCanceled);298});299300test('error.isCanceled is false when kill method is used', async t => {Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
lines 301–302why, one step back301 const abortController = new AbortController();302 const subprocess = execa('noop.js', {signal: abortController.signal});Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 303–307why, one step back303 subprocess.kill();304 const {isCanceled} = await t.throwsAsync(subprocess);305 t.false(isCanceled);306});307Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
lines 308–312why, one step back308test('calling abort throws an error with message "Command was canceled"', async t => {309 const abortController = new AbortController();310 const subprocess = execa('noop.js', {signal: abortController.signal});311 abortController.abort();312 await t.throwsAsync(subprocess, {message: /Command was canceled/});Add `serialization` option (#392)ehmickybefore adoption31ac967
lines 313–314why, one step back313});314Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
lines 315–319why, one step back315test('calling abort twice should show the same behaviour as calling it once', async t => {316 const abortController = new AbortController();317 const subprocess = execa('noop.js', {signal: abortController.signal});318 abortController.abort();319 abortController.abort();Add `serialization` option (#392)ehmickybefore adoption31ac967
line 320why, one step back320 const {isCanceled} = await t.throwsAsync(subprocess);Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
line 321why, one step back321 t.true(isCanceled);Add `serialization` option (#392)ehmickybefore adoption31ac967
line 322why, one step back322});Support `AbortController` (#490)Gyubongbefore adoptionc6e791a
line 323why, one step back323Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
lines 324–329why, one step back324test('calling abort on a successfully completed process does not make result.isCanceled true', async t => {325 const abortController = new AbortController();326 const subprocess = execa('noop.js', {signal: abortController.signal});327 const result = await subprocess;328 abortController.abort();329 t.false(result.isCanceled);Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d
lines 330–344why, one step back330});331332test('child process errors are handled', async t => {333 const subprocess = execa('forever.js');334 subprocess.emit('error', new Error('test'));335 await t.throwsAsync(subprocess, {message: 'Command failed: forever.js\ntest'});336});337338test('child process errors use killSignal', async t => {339 const subprocess = execa('forever.js', {killSignal: 'SIGINT'});340 await once(subprocess, 'spawn');341 subprocess.emit('error', new Error('test'));342 const {isTerminated, signal} = await t.throwsAsync(subprocess, {message: /test/});343 t.true(isTerminated);344 t.is(signal, 'SIGINT');Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6
line 345why, one step back345});