Require Node.js 22 (#1243)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sindre Sorhus · committed by GitHub · parent b886883 · Browse files · 90 files·+454 added−428 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
90 files+454 added−428 removed
- tests:+135 added−151 removed
- other:+319 added−277 removed
Provenance
- Commit
04b4454- Tree
1b09120- Author
Sindre Sorhus <sindresorhus@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
b886883
90 files changed+454 added−428 removed
modified:.github/workflows/main.yml+7 added-6 removed
10 unmodified lines111213141515161718192021212223242526272627282930313132333334353637383940414 unmodified lines10 unmodified lines matrix: node-version: - 26 - 24 - 18 - 22 os: - ubuntu - macos - windows steps: - uses: actions/cache@v4 - uses: actions/cache@v6 with: path: .lycheecache key: cache-lychee-${{ github.sha }} restore-keys: cache-lychee- - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - uses: actions/checkout@v7 - uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - run: npm install - uses: lycheeverse/lychee-action@v1 - uses: lycheeverse/lychee-action@v2 with: args: --cache --verbose --no-progress --include-fragments --exclude packagephobia --exclude /pull/ --exclude linkedin --exclude stackoverflow --exclude stackexchange --exclude github.com/nodejs/node --exclude file:///test --exclude invalid.com '*.md' 'docs/*.md' '.github/**/*.md' '*.json' '*.js' 'lib/**/*.js' 'test/**/*.js' '*.ts' 'test-d/**/*.ts' args: --cache --verbose --no-progress --include-fragments --exclude packagephobia --exclude /pull/ --exclude linkedin --exclude stackoverflow --exclude stackexchange --exclude github.com/nodejs/node --exclude github.com/denoland/deno --exclude file:///test --exclude invalid.com '*.md' 'docs/*.md' '.github/**/*.md' '*.json' '*.js' 'lib/**/*.js' 'test/**/*.js' '*.ts' 'test-d/**/*.ts' fail: true if: ${{ matrix.os == 'ubuntu' && matrix.node-version == 26 }} - run: npm run lint if: ${{ matrix.os == 'ubuntu' && matrix.node-version == 26 }} - run: npm run type - run: npm run unit - uses: codecov/codecov-action@v4 with:4 unmodified linesmodified:docs/api.md+1 added-1 removed
943 unmodified lines944 If the subprocess outputs text, specifies its character encoding, either [`'utf8'`](https://en.wikipedia.org/wiki/UTF-8) or [`'utf16le'`](https://en.wikipedia.org/wiki/UTF-16).945 946 If it outputs binary data instead, this should be either:947 - `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).948-- [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#URL_applications), [`'latin1'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) or [`'ascii'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings): encodes the binary output as a string.948+- [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#RFC_4648), [`'latin1'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) or [`'ascii'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings): encodes the binary output as a string.949 950 The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).951 952 [More info.](binary.md)355 unmodified linesmodified:docs/binary.md+1 added-1 removed
28 unmodified lines2930313233333435363742 unmodified lines28 unmodified lines```
## Encoding
When the output is binary, the [`encoding`](api.md#optionsencoding) option can also be set to [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64) or [`'base64url'`](https://en.wikipedia.org/wiki/Base64#URL_applications). The output will be a string then.When the output is binary, the [`encoding`](api.md#optionsencoding) option can also be set to [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64) or [`'base64url'`](https://en.wikipedia.org/wiki/Base64#RFC_4648). The output will be a string then.
```jsconst {stdout} = await execa({encoding: 'hex'})`zip -r - input.txt`;console.log(stdout); // Hexadecimal string42 unmodified linesmodified:docs/termination.md+1 added-1 removed
116 unmodified lines117 process.exitCode = 1;118 });119 ```120 121-However, if any operation is still ongoing, the subprocess will keep running. It can be forcefully ended using [`process.exit(exitCode)`](https://nodejs.org/api/process.html#processexitcode) instead of [`process.exitCode`](https://nodejs.org/api/process.html#processexitcode_1).121+However, if any operation is still ongoing, the subprocess will keep running. It can be forcefully ended using [`process.exit(exitCode)`](https://nodejs.org/api/process.html#processexitcode) instead of [`process.exitCode`](https://nodejs.org/api/process.html#processexitcode-1).122 123 If the subprocess is still alive after 5 seconds, it is forcefully terminated with [`SIGKILL`](#sigkill). This can be [configured or disabled](#forceful-termination) using the [`forceKillAfterDelay`](api.md#optionsforcekillafterdelay) option.124 125 ## Timeout233 unmodified linesmodified:lib/arguments/escape.js+2 added-2 removed
47 unmodified lines48 // Similar to the above RegExp, but works even when Node.js has been built without ICU support.49 // Unlike the above RegExp, it only covers whitespaces and C0/C1 control characters.50 // It does not cover some edge cases, such as Unicode reserved characters.51 // See https://github.com/sindresorhus/execa/issues/114352- // eslint-disable-next-line no-control-regex52+ // eslint-disable-next-line no-control-regex, regexp/no-control-character, unicorn/prefer-unicode-code-point-escapes53 return /[\s\u0000-\u001F\u007F-\u009F\u00AD]/g;54 }55 };56 27 unmodified lines84 ? `"${escapedArgument.replaceAll('"', '""')}"`85 : `'${escapedArgument.replaceAll('\'', '\'\\\'\'')}'`;86 };87 88-const NO_ESCAPE_REGEXP = /^[\w./-]+$/;88+const NO_ESCAPE_REGEXP = /^[\w\-./]+$/;modified:lib/arguments/specific.js+2 added-2 removed
80 unmodified lines81 }82 83 const regexpResult = FD_REGEXP.exec(fdName);84 if (regexpResult !== null) {85- return Number(regexpResult[1]);85+ return Number(regexpResult.groups.fdNumber);86 }87 };88 89-const FD_REGEXP = /^fd(\d+)$/;89+const FD_REGEXP = /^fd(?<fdNumber>\d+)$/;90 91 const addDefaultValue = (optionArray, optionName) => optionArray.map(optionValue => optionValue === undefined92 ? DEFAULT_OPTIONS[optionName]93 : optionValue);19 unmodified linesmodified:lib/convert/readable.js+5 added-3 removed
100 unmodified lines101 };102 103 // When `readable` aborts/errors, do the same on `subprocess.stdout`104 export const onReadableDestroy = async ({subprocessStdout, subprocess, waitReadableDestroy}, error) => {105- if (await waitForConcurrentStreams(waitReadableDestroy, subprocess)) {106- destroyOtherReadable(subprocessStdout, error);107- await waitForSubprocess(subprocess, error);105+ if (!await waitForConcurrentStreams(waitReadableDestroy, subprocess)) {106+ return;107 }108+109+ destroyOtherReadable(subprocessStdout, error);110+ await waitForSubprocess(subprocess, error);111 };112 113 const destroyOtherReadable = (stream, error) => {114 destroyOtherStream(stream, stream.readable, error);1 unmodified linemodified:lib/convert/writable.js+7 added-5 removed
52 unmodified lines53 // Like this, any subprocess failure is propagated as a stream `error` event, instead of being lost.54 // The user does not need to `await` the subprocess anymore, but now needs to await the stream completion or error.55 // When multiple writables are targeting the same stream, they wait for each other, unless the subprocess ends first.56 const onWritableFinal = async (subprocessStdin, subprocess, waitWritableFinal) => {57- if (await waitForConcurrentStreams(waitWritableFinal, subprocess)) {58- if (subprocessStdin.writable) {59- subprocessStdin.end();60- }57+ if (!await waitForConcurrentStreams(waitWritableFinal, subprocess)) {58+ return;59+ }60 62- await subprocess;61+ if (subprocessStdin.writable) {62+ subprocessStdin.end();63 }64+65+ await subprocess;66 };67 68 // When `subprocess.stdin` ends/aborts/errors, do the same on `writable`.69 export const onStdinFinished = async (subprocessStdin, writable, subprocessStdout) => {23 unmodified linesmodified:lib/io/output-async.js+5 added-3 removed
8 unmodified lines9 export const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {10 const pipeGroups = new Map();11 12 for (const [fdNumber, {stdioItems, direction}] of Object.entries(fileDescriptors)) {13- for (const {stream} of stdioItems.filter(({type}) => TRANSFORM_TYPES.has(type))) {13+ const transformItems = stdioItems.filter(({type}) => TRANSFORM_TYPES.has(type));14+ for (const {stream} of transformItems) {15 pipeTransform(subprocess, stream, direction, fdNumber);16 }17 17- for (const {stream} of stdioItems.filter(({type}) => !TRANSFORM_TYPES.has(type))) {18+ const nonTransformItems = stdioItems.filter(({type}) => !TRANSFORM_TYPES.has(type));19+ for (const {stream} of nonTransformItems) {20 pipeStdioItem({21 subprocess,22 stream,23 direction,3 unmodified lines27 });28 }29 }30 29- for (const [outputStream, inputStreams] of pipeGroups.entries()) {31+ for (const [outputStream, inputStreams] of pipeGroups) {32 const inputStream = inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams);33 pipeStreams(inputStream, outputStream);34 }35 };47 unmodified linesmodified:lib/io/output-sync.js+3 added-2 removed
11 unmodified lines12 return {output: Array.from({length: 3})};13 }14 15 const state = {};16- const outputFiles = new Set([]);16+ const outputFiles = new Set();17 const transformedOutput = output.map((result, fdNumber) =>18 transformOutputResultSync({19 result,20 fileDescriptors,101 unmodified lines122 };123 124 // When the `std*` target is a file path/URL or a file descriptor125 const writeToFiles = (serializedResult, stdioItems, outputFiles) => {126- for (const {path, append} of stdioItems.filter(({type}) => FILE_TYPES.has(type))) {126+ const fileItems = stdioItems.filter(({type}) => FILE_TYPES.has(type));127+ for (const {path, append} of fileItems) {128 const pathString = typeof path === 'string' ? path : path.toString();129 if (append || outputFiles.has(pathString)) {130 appendFileSync(path, serializedResult);131 } else {5 unmodified linesmodified:lib/ipc/reference.js+10 added-6 removed
27 unmodified lines28 // To proxy events, we setup some global listeners on the `message` and `disconnect` events.29 // Those should not keep the subprocess alive, so we remove the automatic counting that Node.js is doing.30 // See https://github.com/nodejs/node/blob/1b965270a9c273d4cf70e8808e9d28b9ada7844f/lib/child_process.js#L18031 export const undoAddedReferences = (channel, isSubprocess) => {32- if (isSubprocess) {33- removeReferenceCount(channel);34- removeReferenceCount(channel);32+ if (!isSubprocess) {33+ return;34 }35+36+ removeReferenceCount(channel);37+ removeReferenceCount(channel);38 };39 40 // Reverse it during `disconnect`41 export const redoAddedReferences = (channel, isSubprocess) => {40- if (isSubprocess) {41- addReferenceCount(channel);42- addReferenceCount(channel);42+ if (!isSubprocess) {43+ return;44 }45+46+ addReferenceCount(channel);47+ addReferenceCount(channel);48 };modified:lib/methods/bind.js+4 added-6 removed
3 unmodified lines4 // Deep merge specific options like `env`. Shallow merge the other ones.5 // Use spread (which only copies own properties) to safely read from boundOptions without prototype pollution6 export const mergeOptions = (boundOptions, options) => {7 const safeBoundOptions = {__proto__: null, ...boundOptions};8- const mergedOptions = Object.fromEntries(9- Object.entries(options).map(([optionName, optionValue]) => [10- optionName,11- mergeOption(optionName, safeBoundOptions[optionName], optionValue),12- ]),8+ const mergedOptions = Object.fromEntries(Object.entries(options).map(([optionName, optionValue]) => [9+ optionName,10+ mergeOption(optionName, safeBoundOptions[optionName], optionValue),11+ ]));13- );12 return {...safeBoundOptions, ...mergedOptions};13 };14 15 const mergeOption = (optionName, boundOptionValue, optionValue) => {8 unmodified linesmodified:lib/methods/main-async.js+1 added-1 removed
88 unmodified lines89 });90 }91 92 const controller = new AbortController();93- setMaxListeners(Number.POSITIVE_INFINITY, controller.signal);93+ setMaxListeners(Infinity, controller.signal);94 95 const originalStreams = [...subprocess.stdio];96 pipeOutputAsync(subprocess, fileDescriptors, controller);97 cleanupOnExit(subprocess, options, controller);97 unmodified linesmodified:lib/resolve/wait-stream.js+2 added-1 removed
29 unmodified lines30 // For example, `stdin: 'pipe'` is implemented as a TCP socket, and its `.destroy()` method waits for TCP disconnection.31 // Therefore `.destroy()` might end before or after subprocess exit, based on OS speed and load.32 // The only way to detect this is to spy on `subprocess.stdin._destroy()` by wrapping it.33 // If `subprocess.exitCode` or `subprocess.signalCode` is set, it means `.destroy()` is being called by Node.js itself.34-const handleStdinDestroy = (stream, {originalStreams: [originalStdin], subprocess}) => {34+const handleStdinDestroy = (stream, {originalStreams, subprocess}) => {35+ const [originalStdin] = originalStreams;36 const state = {stdinCleanedUp: false};37 if (stream === originalStdin) {38 spyOnStdinDestroy(stream, subprocess, state);39 }58 unmodified linesmodified:lib/return/final-error.js+15 added-11 removed
9 unmodified lines10 export class DiscardedError extends Error {}11 12 // Proper way to set `error.name`: it should be inherited and non-enumerable13 const setErrorName = (ErrorClass, value) => {14+ Object.defineProperties(ErrorClass.prototype, {14- Object.defineProperty(ErrorClass.prototype, 'name', {15- value,16- writable: true,17- enumerable: false,18- configurable: true,15+ name: {16+ value,17+ writable: true,18+ enumerable: false,19+ configurable: true,20+ },21+ [execaErrorSymbol]: {22+ value: true,23+ writable: false,24+ enumerable: false,25+ configurable: false,26+ },27 });20- Object.defineProperty(ErrorClass.prototype, execaErrorSymbol, {21- value: true,22- writable: false,23- enumerable: false,24- configurable: false,25- });28 };29 30 // Unlike `instanceof`, this works across realms31 export const isExecaError = error => isErrorInstance(error) && execaErrorSymbol in error;3 unmodified lines35 export const isErrorInstance = value => Object.prototype.toString.call(value) === '[object Error]';36 37 // We use two different Error classes for async/sync methods since they have slightly different shape and types38 export class ExecaError extends Error {}39+// eslint-disable-next-line unicorn/no-top-level-side-effects -- `error.name` must be set as soon as the class is defined40 setErrorName(ExecaError, ExecaError.name);41 42 export class ExecaSyncError extends Error {}43+// eslint-disable-next-line unicorn/no-top-level-side-effects -- `error.name` must be set as soon as the class is defined44 setErrorName(ExecaSyncError, ExecaSyncError.name);modified:lib/stdio/input-option.js+13 added-9 removed
8 unmodified lines9 ...handleInputFileOption(inputFile),10 ]11 : [];12 13+const handleInputOption = input => input === undefined14+ ? []13-const handleInputOption = input => input === undefined ? [] : [{14- type: getInputType(input),15- value: input,16- optionName: 'input',17-}];15+ : [{16+ type: getInputType(input),17+ value: input,18+ optionName: 'input',19+ }];20 21 const getInputType = input => {22 if (isReadableStream(input, {checkOpen: false})) {23 return 'nodeStream';9 unmodified lines33 34 throw new Error('The `input` option must be a string, a Uint8Array or a Node.js Readable stream.');35 };36 37+const handleInputFileOption = inputFile => inputFile === undefined38+ ? []35-const handleInputFileOption = inputFile => inputFile === undefined ? [] : [{36- ...getInputFileType(inputFile),37- optionName: 'inputFile',38-}];39+ : [{40+ ...getInputFileType(inputFile),41+ optionName: 'inputFile',42+ }];43 44 const getInputFileType = inputFile => {45 if (isUrl(inputFile)) {46 return {type: 'fileUrl', value: inputFile};8 unmodified linesmodified:lib/transform/normalize.js+6 added-11 removed
49 unmodified lines50 encoding,51 });52 };53 54-const normalizeDuplex = ({55- stdioItem,56- stdioItem: {57- value: {58- transform,59- transform: {writableObjectMode, readableObjectMode},60- objectMode = readableObjectMode,61- },62- },63- optionName,64-}) => {54+const normalizeDuplex = ({stdioItem, optionName}) => {55+ const {value} = stdioItem;56+ const {transform} = value;57+ const {writableObjectMode, readableObjectMode} = transform;58+ const {objectMode = readableObjectMode} = value;59+60 if (objectMode && !readableObjectMode) {61 throw new TypeError(`The \`${optionName}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);62 }63 43 unmodified linesmodified:lib/utils/max-listeners.js+1 added-1 removed
1 unmodified line2 3 // Temporarily increase the maximum number of listeners on an eventEmitter4 export const incrementMaxListeners = (eventEmitter, maxListenersIncrement, signal) => {5 const maxListeners = eventEmitter.getMaxListeners();6- if (maxListeners === 0 || maxListeners === Number.POSITIVE_INFINITY) {6+ if (maxListeners === 0 || maxListeners === Infinity) {7 return;8 }9 10 eventEmitter.setMaxListeners(maxListeners + maxListenersIncrement);4 unmodified linesmodified:lib/verbose/log.js+14 added-14 removed
18 unmodified lines19 console.warn(finalLines.slice(0, -1));20 }21 };22 23-const getVerboseObject = ({24- type,25- result,26- verboseInfo: {escapedCommand, commandId, rawOptions: {piped = false, ...options}},27-}) => ({28- type,29- escapedCommand,30- commandId: `${commandId}`,31- timestamp: new Date(),32- piped,33- result,34- options,35-});23+const getVerboseObject = ({type, result, verboseInfo}) => {24+ const {escapedCommand, commandId, rawOptions} = verboseInfo;25+ const {piped = false, ...options} = rawOptions;26+ return {27+ type,28+ escapedCommand,29+ commandId: `${commandId}`,30+ timestamp: new Date(),31+ piped,32+ result,33+ options,34+ };35+};36 37 const getPrintedLines = (verboseMessage, verboseObject) => verboseMessage38 .split('\n')39 .map(message => getPrintedLine({...verboseObject, message}));6 unmodified lines46 // Serialize any type to a line string, for logging47 export const serializeVerboseMessage = message => {48 const messageString = typeof message === 'string' ? message : inspect(message);49 const escapedMessage = escapeLines(messageString);50- return escapedMessage.replaceAll('\t', ' '.repeat(TAB_SIZE));50+ return escapedMessage.replaceAll('\t', () => ' '.repeat(TAB_SIZE));51 };52 53 // Same as `util.inspect()`54 const TAB_SIZE = 2;modified:lib/verbose/output.js+1 added-1 removed
11 unmodified lines12 && isFullVerbose(verboseInfo, fdNumber)13 && !BINARY_ENCODINGS.has(encoding)14 && fdUsesVerbose(fdNumber)15 && (stdioItems.some(({type, value}) => type === 'native' && PIPED_STDIO_VALUES.has(value))16- || stdioItems.every(({type}) => TRANSFORM_TYPES.has(type)));16+ || stdioItems.every(({type}) => TRANSFORM_TYPES.has(type)));17 18 // Printing input streams would be confusing.19 // Files and streams can produce big outputs, which we don't want to print.20 // We could print `stdio[3+]` but it often is redirected to files and streams, with the same issue.40 unmodified linesmodified:test/arguments/encoding-option.js+1 added-1 removed
19 unmodified lines20 test('cannot pass encoding: false', testInvalidEncoding, false, UNKNOWN_ENCODING_MESSAGE, execa);21 test('cannot pass encoding: Symbol', testInvalidEncoding, Symbol('test'), UNKNOWN_ENCODING_MESSAGE, execa);22 test('cannot pass encoding: null', testInvalidEncoding, null, getCorrectEncodingMessage('buffer'), execa);23 test('cannot pass encoding: null, sync', testInvalidEncoding, null, getCorrectEncodingMessage('buffer'), execaSync);24-/* eslint-disable unicorn/text-encoding-identifier-case */24+/* eslint-disable unicorn/text-encoding-identifier-case -- intentionally testing invalid encoding casing */25 test('cannot pass encoding: utf-8', testInvalidEncoding, 'utf-8', getCorrectEncodingMessage('utf8'), execa);26 test('cannot pass encoding: utf-8, sync', testInvalidEncoding, 'utf-8', getCorrectEncodingMessage('utf8'), execaSync);27 test('cannot pass encoding: UTF-8', testInvalidEncoding, 'UTF-8', getCorrectEncodingMessage('utf8'), execa);28 test('cannot pass encoding: UTF-8, sync', testInvalidEncoding, 'UTF-8', getCorrectEncodingMessage('utf8'), execaSync);11 unmodified linesmodified:test/arguments/escape-no-icu.js+3 added-2 removed
1 // Mimics Node.js when built without ICU support2 // See https://github.com/sindresorhus/execa/issues/11433+// eslint-disable-next-line unicorn/no-global-object-property-assignment -- intentionally mocking the global `RegExp`4 globalThis.RegExp = class extends RegExp {5+ static isMocked = true;6+7 constructor(regExpString, flags) {8 if (flags?.includes('u') && regExpString.includes('\\p{')) {9 throw new Error('Invalid property name');10 }11 12 super(regExpString, flags);13 }11-12- static isMocked = true;14 };15 16 // Execa computes the RegExp when first loaded, so we must delay this import17 await import('./escape.js');modified:test/arguments/escape.js+13 added-12 removed
21 unmodified lines22 test(testResultCommand, '');23 24 // eslint-disable-next-line max-params25 const testEscapedCommand = async (t, commandArguments, expectedUnix, expectedWindows, expectedUnixNoIcu = expectedUnix, expectedWindowsNoIcu = expectedWindows) => {26+ // eslint-disable-next-line no-use-extend-native/no-use-extend-native -- `RegExp.isMocked` is a static property added by `escape-no-icu.js`, not a native extension27 const expected = RegExp.isMocked28 ? (isWindows ? expectedWindowsNoIcu : expectedUnixNoIcu)29 : (isWindows ? expectedWindows : expectedUnix);30 49 unmodified lines80 test('result.escapedCommand - {}', testEscapedCommand, ['{}'], '\'{}\'', '"{}"');81 test('result.escapedCommand - []', testEscapedCommand, ['[]'], '\'[]\'', '"[]"');82 test('result.escapedCommand - <>', testEscapedCommand, ['<>'], '\'<>\'', '"<>"');83 test('result.escapedCommand - ã', testEscapedCommand, ['ã'], '\'ã\'', '"ã"');83-test('result.escapedCommand - \\a', testEscapedCommand, ['\u0007'], '\'\\u0007\'', '"\\u0007"');84+test('result.escapedCommand - \\a', testEscapedCommand, ['\u{7}'], '\'\\u0007\'', '"\\u0007"');85 test('result.escapedCommand - \\b', testEscapedCommand, ['\b'], '\'\\b\'', '"\\b"');85-test('result.escapedCommand - \\e', testEscapedCommand, ['\u001B'], '\'\\u001b\'', '"\\u001b"');86+test('result.escapedCommand - \\e', testEscapedCommand, ['\u{1B}'], '\'\\u001b\'', '"\\u001b"');87 test('result.escapedCommand - \\f', testEscapedCommand, ['\f'], '\'\\f\'', '"\\f"');88 test('result.escapedCommand - \\n', testEscapedCommand, ['\n'], '\'\\n\'', '"\\n"');89 test('result.escapedCommand - \\r\\n', testEscapedCommand, ['\r\n'], '\'\\r\\n\'', '"\\r\\n"');90 test('result.escapedCommand - \\t', testEscapedCommand, ['\t'], '\'\\t\'', '"\\t"');91 test('result.escapedCommand - \\v', testEscapedCommand, ['\v'], '\'\\u000b\'', '"\\u000b"');91-test('result.escapedCommand - \\x01', testEscapedCommand, ['\u0001'], '\'\\u0001\'', '"\\u0001"');92-test('result.escapedCommand - \\x7f', testEscapedCommand, ['\u007F'], '\'\\u007f\'', '"\\u007f"');93-test('result.escapedCommand - \\u0085', testEscapedCommand, ['\u0085'], '\'\\u0085\'', '"\\u0085"');94-test('result.escapedCommand - \\u2000', testEscapedCommand, ['\u2000'], '\'\\u2000\'', '"\\u2000"');95-test('result.escapedCommand - \\u200E', testEscapedCommand, ['\u200E'], '\'\\u200e\'', '"\\u200e"', '\'\u200E\'', '"\u200E"');96-test('result.escapedCommand - \\u2028', testEscapedCommand, ['\u2028'], '\'\\u2028\'', '"\\u2028"');97-test('result.escapedCommand - \\u2029', testEscapedCommand, ['\u2029'], '\'\\u2029\'', '"\\u2029"');98-test('result.escapedCommand - \\u5555', testEscapedCommand, ['\u5555'], '\'\u5555\'', '"\u5555"');99-test('result.escapedCommand - \\uD800', testEscapedCommand, ['\uD800'], '\'\\ud800\'', '"\\ud800"', '\'\uD800\'', '"\uD800"');100-test('result.escapedCommand - \\uE000', testEscapedCommand, ['\uE000'], '\'\\ue000\'', '"\\ue000"', '\'\uE000\'', '"\uE000"');92+test('result.escapedCommand - \\x01', testEscapedCommand, ['\u{1}'], '\'\\u0001\'', '"\\u0001"');93+test('result.escapedCommand - \\x7f', testEscapedCommand, ['\u{7F}'], '\'\\u007f\'', '"\\u007f"');94+test('result.escapedCommand - \\u0085', testEscapedCommand, ['\u{85}'], '\'\\u0085\'', '"\\u0085"');95+test('result.escapedCommand - \\u2000', testEscapedCommand, ['\u{2000}'], '\'\\u2000\'', '"\\u2000"');96+test('result.escapedCommand - \\u200E', testEscapedCommand, ['\u{200E}'], '\'\\u200e\'', '"\\u200e"', '\'\u{200E}\'', '"\u{200E}"');97+test('result.escapedCommand - \\u2028', testEscapedCommand, ['\u{2028}'], '\'\\u2028\'', '"\\u2028"');98+test('result.escapedCommand - \\u2029', testEscapedCommand, ['\u{2029}'], '\'\\u2029\'', '"\\u2029"');99+test('result.escapedCommand - \\u5555', testEscapedCommand, ['\u{5555}'], '\'\u{5555}\'', '"\u{5555}"');100+test('result.escapedCommand - \\uD800', testEscapedCommand, ['\u{D800}'], '\'\\ud800\'', '"\\ud800"', '\'\u{D800}\'', '"\u{D800}"');101+test('result.escapedCommand - \\uE000', testEscapedCommand, ['\u{E000}'], '\'\\ue000\'', '"\\ue000"', '\'\u{E000}\'', '"\u{E000}"');102 test('result.escapedCommand - \\U1D172', testEscapedCommand, ['\u{1D172}'], '\'\u{1D172}\'', '"\u{1D172}"');103 test('result.escapedCommand - \\U1D173', testEscapedCommand, ['\u{1D173}'], '\'\\U1d173\'', '"\\U1d173"', '\'\u{1D173}\'', '"\u{1D173}"');104 test('result.escapedCommand - \\U10FFFD', testEscapedCommand, ['\u{10FFFD}'], '\'\\U10fffd\'', '"\\U10fffd"', '\'\u{10FFFD}\'', '"\u{10FFFD}"');modified:test/fixtures/graceful-disconnect.js+1 added-1 removed
1 #!/usr/bin/env node2 import process from 'node:process';3 import {once} from 'node:events';4-import {getCancelSignal, sendMessage} from 'execa';4 import {onAbortedSignal} from '../helpers/graceful.js';5+import {getCancelSignal, sendMessage} from 'execa';6 7 const cancelSignal = await getCancelSignal();8 await onAbortedSignal(cancelSignal);9 await Promise.all([3 unmodified linesmodified:test/fixtures/graceful-print.js+1 added-1 removed
1 #!/usr/bin/env node2-import {getCancelSignal} from 'execa';2 import {onAbortedSignal} from '../helpers/graceful.js';3+import {getCancelSignal} from 'execa';4 5 const cancelSignal = await getCancelSignal();6 await onAbortedSignal(cancelSignal);7 console.log(cancelSignal.reason);modified:test/fixtures/graceful-send-echo.js+1 added-1 removed
1 #!/usr/bin/env node2-import {getCancelSignal, getOneMessage, sendMessage} from 'execa';2 import {onAbortedSignal} from '../helpers/graceful.js';3+import {getCancelSignal, getOneMessage, sendMessage} from 'execa';4 5 const message = await getOneMessage();6 const cancelSignal = await getCancelSignal();7 await sendMessage(message);2 unmodified linesmodified:test/fixtures/graceful-send-print.js+1 added-1 removed
1 #!/usr/bin/env node2-import {getCancelSignal, sendMessage} from 'execa';2 import {onAbortedSignal} from '../helpers/graceful.js';3+import {getCancelSignal, sendMessage} from 'execa';4 5 const cancelSignal = await getCancelSignal();6 await sendMessage(cancelSignal.aborted);7 await onAbortedSignal(cancelSignal);1 unmodified linemodified:test/fixtures/graceful-send-string.js+1 added-1 removed
1 #!/usr/bin/env node2-import {getCancelSignal, sendMessage} from 'execa';2 import {foobarString} from '../helpers/input.js';3+import {getCancelSignal, sendMessage} from 'execa';4 5 await getCancelSignal();6 await sendMessage(foobarString);modified:test/fixtures/graceful-send-twice.js+1 added-1 removed
1 #!/usr/bin/env node2-import {getCancelSignal, sendMessage} from 'execa';2 import {onAbortedSignal} from '../helpers/graceful.js';3+import {getCancelSignal, sendMessage} from 'execa';4 5 const cancelSignal = await getCancelSignal();6 await sendMessage(cancelSignal.aborted);7 await onAbortedSignal(cancelSignal);1 unmodified linemodified:test/fixtures/graceful-send.js+1 added-1 removed
1 #!/usr/bin/env node2-import {getCancelSignal, sendMessage} from 'execa';2 import {onAbortedSignal} from '../helpers/graceful.js';3+import {getCancelSignal, sendMessage} from 'execa';4 5 const cancelSignal = await getCancelSignal();6 await onAbortedSignal(cancelSignal);7 await sendMessage(cancelSignal.reason);modified:test/fixtures/graceful-twice.js+1 added-1 removed
1 #!/usr/bin/env node2-import {getCancelSignal, sendMessage} from 'execa';2 import {onAbortedSignal} from '../helpers/graceful.js';3+import {getCancelSignal, sendMessage} from 'execa';4 5 await getCancelSignal();6 const cancelSignal = await getCancelSignal();7 await onAbortedSignal(cancelSignal);1 unmodified linemodified:test/fixtures/graceful-wait.js+1 added-1 removed
1 #!/usr/bin/env node2-import {getCancelSignal} from 'execa';2 import {onAbortedSignal} from '../helpers/graceful.js';3+import {getCancelSignal} from 'execa';4 5 const cancelSignal = await getCancelSignal();6 await onAbortedSignal(cancelSignal);modified:test/fixtures/ipc-iterate-error.js+1 added-1 removed
12 unmodified lines13 }14 };15 16 process.on('error', () => {});17-// eslint-disable-next-line unicorn/prefer-top-level-await17+18 const promise = echoMessages();19 process.emit('error', new Error(foobarString));20 await promise;modified:test/fixtures/ipc-iterate-twice.js+1 added
6 unmodified lines7 sendMessage(foobarString);8 // eslint-disable-next-line no-await-in-loop9 for await (const message of getEachMessage()) {10 if (message === foobarString) {11+ // eslint-disable-next-line unicorn/no-break-in-nested-loop -- breaks only the inner loop, the outer loop must continue12 break;13 }14 15 await sendMessage(`${index}${message}`);2 unmodified linesmodified:test/fixtures/ipc-print-many-each.js+1 added
6 unmodified lines7 for (let index = 0; index < count; index += 1) {8 // eslint-disable-next-line no-await-in-loop, no-unreachable-loop9 for await (const message of getEachMessage()) {10 console.log(message);11+ // eslint-disable-next-line unicorn/no-break-in-nested-loop -- breaks only the inner loop, the outer loop must continue12 break;13 }14 }modified:test/helpers/convert.js+1 added-1 removed
1 unmodified line2 import {finished} from 'node:stream/promises';3 import getStream from 'get-stream';4 import isPlainObj from 'is-plain-obj';5 import {execa} from '../../index.js';6-import {foobarString} from '../helpers/input.js';6+import {foobarString} from './input.js';7 8 export const arrayFromAsync = async (asyncIterable, lines = []) => {9 for await (const line of asyncIterable) {10 lines.push(line);68 unmodified linesmodified:test/helpers/encoding.js+1 added-1 removed
2 unmodified lines3 export const multibyteChar = '\u{1F984}';4 export const multibyteString = `${multibyteChar}${multibyteChar}`;5 export const multibyteUint8Array = textEncoder.encode(multibyteString);6 export const breakingLength = multibyteUint8Array.length * 0.75;7-export const brokenSymbol = '\uFFFD';7+export const brokenSymbol = '\u{FFFD}';modified:test/helpers/fixtures-directory.js+1 added
3 unmodified lines4 import logProcessErrors from 'log-process-errors';5 import pathKey from 'path-key';6 7 // Make tests fail if any warning (such as a deprecation warning) is emitted8+// eslint-disable-next-line unicorn/no-top-level-side-effects -- must run as soon as this helper is imported9 logProcessErrors({10 onError(error, event) {11 if (event === 'warning') {12 throw error;15 unmodified linesmodified:test/helpers/input.js+1 added-1 removed
2 unmodified lines3 4 const textEncoder = new TextEncoder();5 6 export const foobarString = 'foobar';7-export const foobarRed = `\u001B[31m${foobarString}\u001B[39m`;7+export const foobarRed = `\u{1B}[31m${foobarString}\u{1B}[39m`;8 export const foobarArray = ['foo', 'bar'];9 export const foobarUint8Array = textEncoder.encode(foobarString);10 export const foobarArrayBuffer = foobarUint8Array.buffer;11 export const foobarUint16Array = new Uint16Array(foobarArrayBuffer);11 unmodified linesmodified:test/helpers/node-version.js+1 added-1 removed
1 import {version} from 'node:process';2 3-export const majorNodeVersion = Number(version.split('.')[0].slice(1));3+export const majorNodeVersion = Number(version.split('.', 1)[0].slice(1));modified:test/helpers/override-promise.js+2 added
1 // Can't use `test.before`, because `ava` needs `Promise`.2 const nativePromise = Promise;3+// eslint-disable-next-line unicorn/no-global-object-property-assignment -- intentionally mocking the global `Promise`4 globalThis.Promise = class BrokenPromise {5 then() { // eslint-disable-line unicorn/no-thenable6 throw new Error('error');7 }8 };9 10 export function restorePromise() {11+ // eslint-disable-next-line unicorn/no-global-object-property-assignment -- restoring the mocked global `Promise`12 globalThis.Promise = nativePromise;13 }modified:test/helpers/verbose.js+1 added-1 removed
83 unmodified lines84 const splitLines = stderr => stderr.split('\n');85 86 const normalizeStderr = stderr => replaceSymbols(normalizeDuration(normalizeTimestamp(stripVTControlCharacters(stderr))), {useFallback: true});87 export const testTimestamp = '[00:00:00.000]';88-const normalizeTimestamp = stderr => stderr.replaceAll(/^\[\d{2}:\d{2}:\d{2}.\d{3}]/gm, testTimestamp);88+const normalizeTimestamp = stderr => stderr.replaceAll(/^\[\d{2}:\d{2}:\d{2}.\d{3}\]/gm, () => testTimestamp);89 const normalizeDuration = stderr => stderr.replaceAll(/\(done in [^)]+\)/g, '(done in 0ms)');90 91 export const getVerboseOption = (isVerbose, verbose = 'short') => ({verbose: isVerbose ? verbose : 'none'});92 12 unmodified linesmodified:test/helpers/wait.js+2 added-2 removed
1-import {getStdio} from '../helpers/stdio.js';2-import {noopGenerator} from '../helpers/generator.js';1+import {getStdio} from './stdio.js';2+import {noopGenerator} from './generator.js';3 4 export const endOptionStream = ({stream}) => {5 stream.end();6 };11 unmodified linesmodified:test/io/output-async.js+4 added-8 removed
39 unmodified lines40 test.serial('process.std* listeners are cleaned up on success with a single input', testListenersCleanup, false);41 test.serial('process.std* listeners are cleaned up on success with multiple inputs', testListenersCleanup, true);42 43 test.serial('Can spawn many subprocesses in parallel', async t => {44- const results = await Promise.all(45- Array.from({length: PARALLEL_COUNT}, () => execa('noop.js', [foobarString])),46- );44+ const results = await Promise.all(Array.from({length: PARALLEL_COUNT}, () => execa('noop.js', [foobarString])));45 t.true(results.every(({stdout}) => stdout === foobarString));46 });47 48 const testMaxListeners = async (t, isMultiple, maxListenersCount) => {3 unmodified lines52 standardStream.setMaxListeners(maxListenersCount);53 }54 55 try {58- const results = await Promise.all(59- Array.from({length: PARALLEL_COUNT}, () => execa('empty.js', getComplexStdio(isMultiple))),60- );56+ const results = await Promise.all(Array.from({length: PARALLEL_COUNT}, () => execa('empty.js', getComplexStdio(isMultiple))));57 t.true(results.every(({exitCode}) => exitCode === 0));58 } finally {59 await setImmediate();60 await setImmediate();8 unmodified lines69 70 test.serial('No warning with maxListeners 1 and ["pipe", "inherit"]', testMaxListeners, false, 1);71 test.serial('No warning with maxListeners default and ["pipe", "inherit"]', testMaxListeners, false, defaultMaxListeners);72 test.serial('No warning with maxListeners 100 and ["pipe", "inherit"]', testMaxListeners, false, 100);77-test.serial('No warning with maxListeners Infinity and ["pipe", "inherit"]', testMaxListeners, false, Number.POSITIVE_INFINITY);73+test.serial('No warning with maxListeners Infinity and ["pipe", "inherit"]', testMaxListeners, false, Infinity);74 test.serial('No warning with maxListeners 0 and ["pipe", "inherit"]', testMaxListeners, false, 0);75 test.serial('No warning with maxListeners 1 and ["pipe", "inherit"], multiple inputs', testMaxListeners, true, 1);76 test.serial('No warning with maxListeners default and ["pipe", "inherit"], multiple inputs', testMaxListeners, true, defaultMaxListeners);77 test.serial('No warning with maxListeners 100 and ["pipe", "inherit"], multiple inputs', testMaxListeners, true, 100);82-test.serial('No warning with maxListeners Infinity and ["pipe", "inherit"], multiple inputs', testMaxListeners, true, Number.POSITIVE_INFINITY);78+test.serial('No warning with maxListeners Infinity and ["pipe", "inherit"], multiple inputs', testMaxListeners, true, Infinity);79 test.serial('No warning with maxListeners 0 and ["pipe", "inherit"], multiple inputs', testMaxListeners, true, 0);modified:test/ipc/buffer-messages.js+4 added-6 removed
77 unmodified lines78 t.deepEqual(ipcOutput, []);79 });80 81 test.serial('Can retrieve initial IPC messages under heavy load', async t => {82- await Promise.all(83- Array.from({length: PARALLEL_COUNT}, async (_, index) => {84- const {ipcOutput} = await execa('ipc-send-argv.js', [`${index}`], {ipc: true});85- t.deepEqual(ipcOutput, [`${index}`]);86- }),82+ await Promise.all(Array.from({length: PARALLEL_COUNT}, async (_, index) => {83+ const {ipcOutput} = await execa('ipc-send-argv.js', [`${index}`], {ipc: true});84+ t.deepEqual(ipcOutput, [`${index}`]);85+ }));87- );86 });modified:test/ipc/get-one.js+5 added-7 removed
53 unmodified lines54 t.deepEqual(ipcOutput, []);55 });56 57 test.serial('Can retrieve initial IPC messages under heavy load', async t => {58- await Promise.all(59- Array.from({length: PARALLEL_COUNT}, async (_, index) => {60- const subprocess = execa('ipc-send-argv.js', [`${index}`], {ipc: true, buffer: false});61- t.is(await subprocess.getOneMessage(), `${index}`);62- await subprocess;63- }),58+ await Promise.all(Array.from({length: PARALLEL_COUNT}, async (_, index) => {59+ const subprocess = execa('ipc-send-argv.js', [`${index}`], {ipc: true, buffer: false});60+ t.is(await subprocess.getOneMessage(), `${index}`);61+ await subprocess;62+ }));64- );63 });64 65 const testTwice = async (t, buffer, filter) => {66 const subprocess = execa('ipc-send.js', {ipc: true, buffer});65 unmodified linesmodified:test/ipc/send.js+7 added-10 removed
13 unmodified lines14 await subprocess;15 });16 17 test.serial('Can exchange IPC messages under heavy load', async t => {18- await Promise.all(19- Array.from({length: PARALLEL_COUNT}, async (_, index) => {20- const subprocess = execa('ipc-echo.js', {ipc: true});21- await subprocess.sendMessage(index);22- t.is(await subprocess.getOneMessage(), index);23- await subprocess;24- }),18+ await Promise.all(Array.from({length: PARALLEL_COUNT}, async (_, index) => {19+ const subprocess = execa('ipc-echo.js', {ipc: true});20+ await subprocess.sendMessage(index);21+ t.is(await subprocess.getOneMessage(), index);22+ await subprocess;23+ }));25- );24 });25 26 test('The "serialization" option defaults to "advanced"', async t => {27 const subprocess = execa('ipc-echo.js', {ipc: true});56 unmodified lines84 });85 86 // EPIPE happens based on timing conditions, so we must repeat it until it happens87 const findEpipeError = async t => {90- // eslint-disable-next-line no-constant-condition88 while (true) {89 // eslint-disable-next-line no-await-in-loop90 const error = await t.throwsAsync(getEpipeError());91 if (error.cause?.code === 'EPIPE') {3 unmodified lines95 };96 97 const getEpipeError = async () => {98 const subprocess = execa('delay.js', ['0'], {ipc: true});102- // eslint-disable-next-line no-constant-condition99+100 while (true) {101 // eslint-disable-next-line no-await-in-loop102 await subprocess.sendMessage('.');103 }40 unmodified linesmodified:test/methods/command.js+1 added
193 unmodified lines194 t.deepEqual(parseCommandString(''), []);195 });196 197 test('parseCommandString() can get only whitespaces', t => {198+ // eslint-disable-next-line unicorn/prefer-string-repeat199 t.deepEqual(parseCommandString(' '), []);200 });modified:test/methods/parameters-options.js+10 added-10 removed
19 unmodified lines20 };21 22 test('execa()\'s arguments can be numbers', testSerializeArgument, 1, execa);23 test('execa()\'s arguments can be booleans', testSerializeArgument, true, execa);24-test('execa()\'s arguments can be NaN', testSerializeArgument, Number.NaN, execa);25-test('execa()\'s arguments can be Infinity', testSerializeArgument, Number.POSITIVE_INFINITY, execa);24+test('execa()\'s arguments can be NaN', testSerializeArgument, NaN, execa);25+test('execa()\'s arguments can be Infinity', testSerializeArgument, Infinity, execa);26 test('execa()\'s arguments can be null', testSerializeArgument, null, execa);27 test('execa()\'s arguments can be undefined', testSerializeArgument, undefined, execa);28 test('execa()\'s arguments can be bigints', testSerializeArgument, 1n, execa);29 test('execa()\'s arguments can be symbols', testSerializeArgument, Symbol('test'), execa);30 test('execaSync()\'s arguments can be numbers', testSerializeArgument, 1, execaSync);31 test('execaSync()\'s arguments can be booleans', testSerializeArgument, true, execaSync);32-test('execaSync()\'s arguments can be NaN', testSerializeArgument, Number.NaN, execaSync);33-test('execaSync()\'s arguments can be Infinity', testSerializeArgument, Number.POSITIVE_INFINITY, execaSync);32+test('execaSync()\'s arguments can be NaN', testSerializeArgument, NaN, execaSync);33+test('execaSync()\'s arguments can be Infinity', testSerializeArgument, Infinity, execaSync);34 test('execaSync()\'s arguments can be null', testSerializeArgument, null, execaSync);35 test('execaSync()\'s arguments can be undefined', testSerializeArgument, undefined, execaSync);36 test('execaSync()\'s arguments can be bigints', testSerializeArgument, 1n, execaSync);37 test('execaSync()\'s arguments can be symbols', testSerializeArgument, Symbol('test'), execaSync);38 test('execaNode()\'s arguments can be numbers', testSerializeArgument, 1, execaNode);39 test('execaNode()\'s arguments can be booleans', testSerializeArgument, true, execaNode);40-test('execaNode()\'s arguments can be NaN', testSerializeArgument, Number.NaN, execaNode);41-test('execaNode()\'s arguments can be Infinity', testSerializeArgument, Number.POSITIVE_INFINITY, execaNode);40+test('execaNode()\'s arguments can be NaN', testSerializeArgument, NaN, execaNode);41+test('execaNode()\'s arguments can be Infinity', testSerializeArgument, Infinity, execaNode);42 test('execaNode()\'s arguments can be null', testSerializeArgument, null, execaNode);43 test('execaNode()\'s arguments can be undefined', testSerializeArgument, undefined, execaNode);44 test('execaNode()\'s arguments can be bigints', testSerializeArgument, 1n, execaNode);45 test('execaNode()\'s arguments can be symbols', testSerializeArgument, Symbol('test'), execaNode);46 test('$\'s arguments can be numbers', testSerializeArgument, 1, $);47 test('$\'s arguments can be booleans', testSerializeArgument, true, $);48-test('$\'s arguments can be NaN', testSerializeArgument, Number.NaN, $);49-test('$\'s arguments can be Infinity', testSerializeArgument, Number.POSITIVE_INFINITY, $);48+test('$\'s arguments can be NaN', testSerializeArgument, NaN, $);49+test('$\'s arguments can be Infinity', testSerializeArgument, Infinity, $);50 test('$\'s arguments can be null', testSerializeArgument, null, $);51 test('$\'s arguments can be undefined', testSerializeArgument, undefined, $);52 test('$\'s arguments can be bigints', testSerializeArgument, 1n, $);53 test('$\'s arguments can be symbols', testSerializeArgument, Symbol('test'), $);54 test('$.sync\'s arguments can be numbers', testSerializeArgument, 1, $.sync);55 test('$.sync\'s arguments can be booleans', testSerializeArgument, true, $.sync);56-test('$.sync\'s arguments can be NaN', testSerializeArgument, Number.NaN, $.sync);57-test('$.sync\'s arguments can be Infinity', testSerializeArgument, Number.POSITIVE_INFINITY, $.sync);56+test('$.sync\'s arguments can be NaN', testSerializeArgument, NaN, $.sync);57+test('$.sync\'s arguments can be Infinity', testSerializeArgument, Infinity, $.sync);58 test('$.sync\'s arguments can be null', testSerializeArgument, null, $.sync);59 test('$.sync\'s arguments can be undefined', testSerializeArgument, undefined, $.sync);60 test('$.sync\'s arguments can be bigints', testSerializeArgument, 1n, $.sync);61 test('$.sync\'s arguments can be symbols', testSerializeArgument, Symbol('test'), $.sync);14 unmodified linesmodified:test/methods/promise.js+2 added-2 removed
14 unmodified lines15 let isCalled = false;16 const {stdout} = await execa('noop.js', ['foo']).finally(() => {17 isCalled = true;18 });19- t.is(isCalled, true);19+ t.true(isCalled);20 t.is(stdout, 'foo');21 });22 23 test('finally function is executed on failure', async t => {24 let isError = false;25 const {stdout, stderr} = await t.throwsAsync(execa('exit.js', ['2']).finally(() => {26 isError = true;27 }));28- t.is(isError, true);28+ t.true(isError);29 t.is(typeof stdout, 'string');30 t.is(typeof stderr, 'string');31 });32 21 unmodified linesmodified:test/methods/template.js+20 added-20 removed
73 unmodified lines74 test('$ splits expressions - " " (2 spaces)', testScriptStdout, () => $`echo.js ${'a'} ${'b'}`, 'a\nb');75 test('$ concatenates tokens - " " (2 spaces)', testScriptStdout, () => $`echo.js a `, 'a');76 test('$ concatenates expressions - " " (2 spaces)', testScriptStdout, () => $`echo.js ${'a'} `, 'a');77 test('$ handles tokens - " " (3 spaces)', testScriptStdout, () => $`echo.js `, '');78+// eslint-disable-next-line unicorn/prefer-string-repeat79 test('$ handles expressions - " " (3 spaces)', testScriptStdout, () => $`echo.js ${' '}`, ' ');80 test('$ splits tokens - " " (3 spaces)', testScriptStdout, () => $`echo.js a b`, 'a\nb');81 test('$ splits expressions - " " (3 spaces)', testScriptStdout, () => $`echo.js ${'a'} ${'b'}`, 'a\nb');82 test('$ concatenates tokens - " " (3 spaces)', testScriptStdout, () => $`echo.js a `, 'a');31 unmodified lines114 test('$ concatenates tokens - \\n (escape)', testScriptStdout, () => $`echo.js \na\n b`, '\na\n\nb');115 test('$ concatenates expressions - \\n (escape)', testScriptStdout, () => $`echo.js \n${'a'}\n b`, '\na\n\nb');116 test('$ handles tokens - \\r (no escape)', testScriptStdout, () => escapedCall('echo.js \r '), '');117 test('$ splits tokens - \\r (no escape)', testScriptStdout, () => escapedCall('echo.js a\rb'), 'a\nb');117-test('$ splits expressions - \\r (no escape)', testScriptStdout, () => escapedCall(`echo.js ${'a'}\r${'b'}`), 'a\nb');118+test('$ splits expressions - \\r (no escape)', testScriptStdout, () => escapedCall('echo.js a\rb'), 'a\nb');119 test('$ concatenates tokens - \\r (no escape)', testScriptStdout, () => escapedCall('echo.js \ra\r b'), 'a\nb');119-test('$ concatenates expressions - \\r (no escape)', testScriptStdout, () => escapedCall(`echo.js \r${'a'}\r b`), 'a\nb');120+test('$ concatenates expressions - \\r (no escape)', testScriptStdout, () => escapedCall('echo.js \ra\r b'), 'a\nb');121 test('$ splits tokens - \\r (escape)', testScriptStdout, () => $`echo.js a\r b`, 'a\r\nb');122 test('$ splits expressions - \\r (escape)', testScriptStdout, () => $`echo.js ${'a'}\r ${'b'}`, 'a\r\nb');123 test('$ concatenates tokens - \\r (escape)', testScriptStdout, () => $`echo.js \ra\r b`, '\ra\r\nb');124 test('$ concatenates expressions - \\r (escape)', testScriptStdout, () => $`echo.js \r${'a'}\r b`, '\ra\r\nb');125 test('$ handles tokens - \\r\\n (no escape)', testScriptStdout, () => escapedCall('echo.js \r\n '), '');126 test('$ splits tokens - \\r\\n (no escape)', testScriptStdout, () => escapedCall('echo.js a\r\nb'), 'a\nb');126-test('$ splits expressions - \\r\\n (no escape)', testScriptStdout, () => escapedCall(`echo.js ${'a'}\r\n${'b'}`), 'a\nb');127+test('$ splits expressions - \\r\\n (no escape)', testScriptStdout, () => escapedCall('echo.js a\r\nb'), 'a\nb');128 test('$ concatenates tokens - \\r\\n (no escape)', testScriptStdout, () => escapedCall('echo.js \r\na\r\n b'), 'a\nb');128-test('$ concatenates expressions - \\r\\n (no escape)', testScriptStdout, () => escapedCall(`echo.js \r\n${'a'}\r\n b`), 'a\nb');129+test('$ concatenates expressions - \\r\\n (no escape)', testScriptStdout, () => escapedCall('echo.js \r\na\r\n b'), 'a\nb');130 test('$ handles tokens - \\r\\n (escape)', testScriptStdout, () => $`echo.js \r\n `, '\r\n');131 test('$ handles expressions - \\r\\n (escape)', testScriptStdout, () => $`echo.js ${'\r\n'} `, '\r\n');132 test('$ splits tokens - \\r\\n (escape)', testScriptStdout, () => $`echo.js a\r\n b`, 'a\r\n\nb');133 test('$ splits expressions - \\r\\n (escape)', testScriptStdout, () => $`echo.js ${'a'}\r\n ${'b'}`, 'a\r\n\nb');134 test('$ concatenates tokens - \\r\\n (escape)', testScriptStdout, () => $`echo.js \r\na\r\n b`, '\r\na\r\n\nb');135 test('$ concatenates expressions - \\r\\n (escape)', testScriptStdout, () => $`echo.js \r\n${'a'}\r\n b`, '\r\na\r\n\nb');135-/* eslint-disable no-irregular-whitespace */136+/* eslint-disable no-irregular-whitespace -- intentionally testing a literal form feed character */137 test('$ handles expressions - \\f (no escape)', testScriptStdout, () => $`echo.js ${''}`, '\f');138 test('$ splits tokens - \\f (no escape)', testScriptStdout, () => $`echo.js ab`, 'a\fb');139 test('$ splits expressions - \\f (no escape)', testScriptStdout, () => $`echo.js ${'a'}${'b'}`, 'a\fb');140 test('$ concatenates tokens - \\f (no escape)', testScriptStdout, () => $`echo.js a b`, '\fa\f\nb');28 unmodified lines169 test('$ splits tokens - \\v', testScriptStdout, () => $`echo.js a\vb`, 'a\vb');170 test('$ splits expressions - \\v', testScriptStdout, () => $`echo.js ${'a'}\v${'b'}`, 'a\vb');171 test('$ concatenates tokens - \\v', testScriptStdout, () => $`echo.js \va\v b`, '\va\v\nb');172 test('$ concatenates expressions - \\v', testScriptStdout, () => $`echo.js \v${'a'}\v b`, '\va\v\nb');172-test('$ handles tokens - \\u2028', testScriptStdout, () => $`echo.js \u2028`, '\u2028');173-test('$ handles expressions - \\u2028', testScriptStdout, () => $`echo.js ${'\u2028'}`, '\u2028');174-test('$ splits tokens - \\u2028', testScriptStdout, () => $`echo.js a\u2028b`, 'a\u2028b');175-test('$ splits expressions - \\u2028', testScriptStdout, () => $`echo.js ${'a'}\u2028${'b'}`, 'a\u2028b');176-test('$ concatenates tokens - \\u2028', testScriptStdout, () => $`echo.js \u2028a\u2028 b`, '\u2028a\u2028\nb');177-test('$ concatenates expressions - \\u2028', testScriptStdout, () => $`echo.js \u2028${'a'}\u2028 b`, '\u2028a\u2028\nb');173+test('$ handles tokens - \\u2028', testScriptStdout, () => $`echo.js \u2028`, '\u{2028}');174+test('$ handles expressions - \\u2028', testScriptStdout, () => $`echo.js ${'\u{2028}'}`, '\u{2028}');175+test('$ splits tokens - \\u2028', testScriptStdout, () => $`echo.js a\u2028b`, 'a\u{2028}b');176+test('$ splits expressions - \\u2028', testScriptStdout, () => $`echo.js ${'a'}\u2028${'b'}`, 'a\u{2028}b');177+test('$ concatenates tokens - \\u2028', testScriptStdout, () => $`echo.js \u2028a\u2028 b`, '\u{2028}a\u{2028}\nb');178+test('$ concatenates expressions - \\u2028', testScriptStdout, () => $`echo.js \u2028${'a'}\u2028 b`, '\u{2028}a\u{2028}\nb');179 test('$ handles tokens - \\a', testScriptStdout, () => $`echo.js \a`, 'a');180 test('$ splits tokens - \\a', testScriptStdout, () => $`echo.js a\ab`, 'aab');181 test('$ splits expressions - \\a', testScriptStdout, () => $`echo.js ${'a'}\a${'b'}`, 'aab');182 test('$ concatenates tokens - \\a', testScriptStdout, () => $`echo.js \aa\a b`, 'aaa\nb');7 unmodified lines190 test('$ splits tokens - \\.', testScriptStdout, () => $`echo.js a\.b`, 'a.b');191 test('$ splits expressions - \\.', testScriptStdout, () => $`echo.js ${'a'}\.${'b'}`, 'a.b');192 test('$ concatenates tokens - \\.', testScriptStdout, () => $`echo.js \.a\. b`, '.a.\nb');193 test('$ concatenates expressions - \\.', testScriptStdout, () => $`echo.js \.${'a'}\. b`, '.a.\nb');193-/* eslint-disable unicorn/no-hex-escape */194+195 test('$ handles tokens - \\x63', testScriptStdout, () => $`echo.js \x63`, 'c');196 test('$ splits tokens - \\x63', testScriptStdout, () => $`echo.js a\x63b`, 'acb');197 test('$ splits expressions - \\x63', testScriptStdout, () => $`echo.js ${'a'}\x63${'b'}`, 'acb');198 test('$ concatenates tokens - \\x63', testScriptStdout, () => $`echo.js \x63a\x63 b`, 'cac\nb');199 test('$ concatenates expressions - \\x63', testScriptStdout, () => $`echo.js \x63${'a'}\x63 b`, 'cac\nb');199-/* eslint-enable unicorn/no-hex-escape */200+201 test('$ handles tokens - \\u0063', testScriptStdout, () => $`echo.js \u0063`, 'c');202 test('$ splits tokens - \\u0063', testScriptStdout, () => $`echo.js a\u0063b`, 'acb');203 test('$ splits expressions - \\u0063', testScriptStdout, () => $`echo.js ${'a'}\u0063${'b'}`, 'acb');204 test('$ concatenates tokens - \\u0063', testScriptStdout, () => $`echo.js \u0063a\u0063 b`, 'cac\nb');205 test('$ concatenates expressions - \\u0063', testScriptStdout, () => $`echo.js \u0063${'a'}\u0063 b`, 'cac\nb');205-test('$ handles tokens - \\u{1}', testScriptStdout, () => $`echo.js \u{1}`, '\u0001');206-test('$ splits tokens - \\u{1}', testScriptStdout, () => $`echo.js a\u{1}b`, 'a\u0001b');207-test('$ splits expressions - \\u{1}', testScriptStdout, () => $`echo.js ${'a'}\u{1}${'b'}`, 'a\u0001b');208-test('$ concatenates tokens - \\u{1}', testScriptStdout, () => $`echo.js \u{1}a\u{1} b`, '\u0001a\u0001\nb');209-test('$ concatenates expressions - \\u{1}', testScriptStdout, () => $`echo.js \u{1}${'a'}\u{1} b`, '\u0001a\u0001\nb');206+test('$ handles tokens - \\u{1}', testScriptStdout, () => $`echo.js \u{1}`, '\u{1}');207+test('$ splits tokens - \\u{1}', testScriptStdout, () => $`echo.js a\u{1}b`, 'a\u{1}b');208+test('$ splits expressions - \\u{1}', testScriptStdout, () => $`echo.js ${'a'}\u{1}${'b'}`, 'a\u{1}b');209+test('$ concatenates tokens - \\u{1}', testScriptStdout, () => $`echo.js \u{1}a\u{1} b`, '\u{1}a\u{1}\nb');210+test('$ concatenates expressions - \\u{1}', testScriptStdout, () => $`echo.js \u{1}${'a'}\u{1} b`, '\u{1}a\u{1}\nb');211 test('$ handles tokens - \\u{63}', testScriptStdout, () => $`echo.js \u{63}`, 'c');212 test('$ splits tokens - \\u{63}', testScriptStdout, () => $`echo.js a\u{63}b`, 'acb');213 test('$ splits expressions - \\u{63}', testScriptStdout, () => $`echo.js ${'a'}\u{63}${'b'}`, 'acb');214 test('$ concatenates tokens - \\u{63}', testScriptStdout, () => $`echo.js \u{63}a\u{63} b`, 'cac\nb');73 unmodified lines288 test('$ handles invalid escape sequence - \\ug', testInvalidSequence, () => $`echo.js \ug`);289 test('$ handles invalid escape sequence - \\u{', testInvalidSequence, () => $`echo.js \u{`);290 test('$ handles invalid escape sequence - \\u{0000', testInvalidSequence, () => $`echo.js \u{0000`);291 test('$ handles invalid escape sequence - \\u{g}', testInvalidSequence, () => $`echo.js \u{g}`);291-/* eslint-disable unicorn/no-hex-escape */292+293 test('$ handles invalid escape sequence - \\x', testInvalidSequence, () => $`echo.js \x`);294 test('$ handles invalid escape sequence - \\x0', testInvalidSequence, () => $`echo.js \x0`);295 test('$ handles invalid escape sequence - \\xgg', testInvalidSequence, () => $`echo.js \xgg`);295-/* eslint-enable unicorn/no-hex-escape */296 297 const testEmptyScript = (t, getSubprocess) => {298 t.throws(getSubprocess, {message: /Template script must not be empty/});299 };53 unmodified linesmodified:test/resolve/exit.js+1 added-3 removed
11 unmodified lines12 t.is(exitCode, 0);13 });14 15 const testExitCode = async (t, expectedExitCode) => {16- const {exitCode, originalMessage, shortMessage, message} = await t.throwsAsync(17- execa('exit.js', [`${expectedExitCode}`]),18- );16+ const {exitCode, originalMessage, shortMessage, message} = await t.throwsAsync(execa('exit.js', [`${expectedExitCode}`]));17 t.is(exitCode, expectedExitCode);18 t.is(originalMessage, undefined);19 t.is(shortMessage, `Command failed with exit code ${expectedExitCode}: exit.js ${expectedExitCode}`);20 t.is(message, shortMessage);63 unmodified linesmodified:test/return/early-error.js+5 added-3 removed
24 unmodified lines25 26 const testEarlyErrorShape = async (t, reject) => {27 const subprocess = getEarlyErrorSubprocess({reject});28 t.notThrows(() => {29- // eslint-disable-next-line promise/prefer-await-to-then29 subprocess.catch(() => {});30 subprocess.unref();31 subprocess.on('error', () => {});32 });30 unmodified lines63 });64 65 if (arch() === 'x64') {66 test('write to fast-exit subprocess', async t => {67+ t.plan(1);68+68- // Try-catch here is necessary, because this test is not 100% accurate69- // Sometimes subprocess can manage to accept input before exiting69+ // Try-catch here is necessary, because this test is not 100% accurate70+ // Sometimes subprocess can manage to accept input before exiting71 try {72 await execa(`fast-exit-${process.platform}`, [], {input: 'data'});73 t.pass();74 } catch (error) {75+ // eslint-disable-next-line ava/no-conditional-assertion -- either outcome is acceptable, see comment above76 t.is(error.code, 'EPIPE');77 }78 });79 }41 unmodified linesmodified:test/return/message.js+2 added-1 removed
71 unmodified lines72 test('error.message does not contain stdout if it is an object', testPartialIgnoreMessage, 1, outputObjectGenerator(), 'stderr');73 test('error.message does not contain stderr if it is an object', testPartialIgnoreMessage, 2, outputObjectGenerator(), 'stdout');74 75 const testFullIgnoreMessage = async (t, options, resultProperty) => {76- const {[resultProperty]: message} = await t.throwsAsync(execa('echo-fail.js', options));76+ const result = await t.throwsAsync(execa('echo-fail.js', options));77+ const message = result[resultProperty];78 t.false(message.includes('stderr'));79 t.false(message.includes('stdout'));80 t.false(message.includes('fd3'));81 };38 unmodified linesmodified:test/return/result.js+2 added-2 removed
95 unmodified lines96 97 // `subprocess.kill()` is emulated by Node.js on Windows98 if (isWindows) {99 const {isTerminated, signal} = await t.throwsAsync(subprocess, {message: /failed with exit code 1/});100- t.is(isTerminated, false);100+ t.false(isTerminated);101 t.is(signal, undefined);102 } else {103 const {isTerminated, signal} = await t.throwsAsync(subprocess, {message: /was killed with SIGINT/});104- t.is(isTerminated, true);104+ t.true(isTerminated);105 t.is(signal, 'SIGINT');106 }107 });108 39 unmodified linesmodified:test/terminate/kill-force.js+1 added-1 removed
43 unmodified lines44 execa('empty.js', {forceKillAfterDelay});45 }, {instanceOf: TypeError, message: /non-negative integer/});46 };47 48-test('`forceKillAfterDelay` should not be NaN', testInvalidForceKill, Number.NaN);48+test('`forceKillAfterDelay` should not be NaN', testInvalidForceKill, NaN);49 test('`forceKillAfterDelay` should not be negative', testInvalidForceKill, -1);50 51 // `SIGTERM` cannot be caught on Windows, and it always aborts the subprocess (like `SIGKILL` on Unix).52 // Therefore, this feature and those tests must be different on Windows.166 unmodified linesmodified:test/terminate/kill-signal.js+4 added-18 removed
1 import {once} from 'node:events';2-import {platform} from 'node:process';2 import {constants} from 'node:os';3 import {setImmediate} from 'node:timers/promises';4 import test from 'ava';5 import {execa, execaSync} from '../../index.js';6 import {setFixtureDirectory} from '../helpers/fixtures-directory.js';8-import {majorNodeVersion} from '../helpers/node-version.js';7 8 setFixtureDirectory();9 12-const isWindows = platform === 'win32';13-10 const testKillSignal = async (t, killSignal) => {11 const {isTerminated, signal} = await t.throwsAsync(execa('forever.js', {killSignal, timeout: 1}));12 t.true(isTerminated);13 t.is(signal, 'SIGINT');42 unmodified lines56 subprocess.kill();57 subprocess.kill();58 59 const {exitCode, isTerminated, signal, code} = await t.throwsAsync(subprocess);64- // On Windows, calling `subprocess.kill()` twice emits an `error` event on the subprocess.65- // This does not happen when passing an `error` argument, nor when passing a non-terminating signal.66- // There is no easy way to make this cross-platform, so we document the difference here.67- if (isWindows && majorNodeVersion === 22) {68- t.is(exitCode, undefined);69- t.false(isTerminated);70- t.is(signal, undefined);71- t.is(code, 'EPERM');72- } else {73- t.is(exitCode, undefined);74- t.true(isTerminated);75- t.is(signal, 'SIGTERM');76- t.is(code, undefined);60+ t.is(exitCode, undefined);61+ t.true(isTerminated);62+ t.is(signal, 'SIGTERM');63+ t.is(code, undefined);77- }64 });65 66 test('execa() returns a promise with kill()', async t => {67 const subprocess = execa('noop.js', ['foo']);73 unmodified linesmodified:test/terminate/signal.js+6 added-6 removed
34 unmodified lines35 test('Cannot use killSignal: -1', testInvalidKillSignal, -1, 'integer', execa);36 test('Cannot use killSignal: 200', testInvalidKillSignal, 200, 'integer', execa);37 test('Cannot use killSignal: 1n', testInvalidKillSignal, 1n, 'other', execa);38 test('Cannot use killSignal: 1.5', testInvalidKillSignal, 1.5, 'other', execa);39-test('Cannot use killSignal: Infinity', testInvalidKillSignal, Number.POSITIVE_INFINITY, 'other', execa);40-test('Cannot use killSignal: NaN', testInvalidKillSignal, Number.NaN, 'other', execa);39+test('Cannot use killSignal: Infinity', testInvalidKillSignal, Infinity, 'other', execa);40+test('Cannot use killSignal: NaN', testInvalidKillSignal, NaN, 'other', execa);41 test('Cannot use killSignal: false', testInvalidKillSignal, false, 'other', execa);42 test('Cannot use killSignal: null', testInvalidKillSignal, null, 'other', execa);43 test('Cannot use killSignal: symbol', testInvalidKillSignal, Symbol('test'), 'other', execa);44 test('Cannot use killSignal: {}', testInvalidKillSignal, {}, 'other', execa);3 unmodified lines48 test('Cannot use killSignal: "sigterm", sync', testInvalidKillSignal, 'sigterm', 'rename', execaSync);49 test('Cannot use killSignal: -1, sync', testInvalidKillSignal, -1, 'integer', execaSync);50 test('Cannot use killSignal: 200, sync', testInvalidKillSignal, 200, 'integer', execaSync);51 test('Cannot use killSignal: 1.5, sync', testInvalidKillSignal, 1.5, 'other', execaSync);52-test('Cannot use killSignal: Infinity, sync', testInvalidKillSignal, Number.POSITIVE_INFINITY, 'other', execaSync);53-test('Cannot use killSignal: NaN, sync', testInvalidKillSignal, Number.NaN, 'other', execaSync);52+test('Cannot use killSignal: Infinity, sync', testInvalidKillSignal, Infinity, 'other', execaSync);53+test('Cannot use killSignal: NaN, sync', testInvalidKillSignal, NaN, 'other', execaSync);54 test('Cannot use killSignal: null, sync', testInvalidKillSignal, null, 'other', execaSync);55 test('Cannot use killSignal: symbol, sync', testInvalidKillSignal, Symbol('test'), 'other', execaSync);56 test('Cannot use killSignal: {}, sync', testInvalidKillSignal, {}, 'other', execaSync);57 test('Cannot use killSignal: 0, sync', testInvalidKillSignal, 0, 'zero', execaSync);20 unmodified lines78 test('Cannot use subprocess.kill(-1)', testInvalidSignalArgument, -1, 'integer');79 test('Cannot use subprocess.kill(200)', testInvalidSignalArgument, 200, 'integer');80 test('Cannot use subprocess.kill(1n)', testInvalidSignalArgument, 1n, 'other');81 test('Cannot use subprocess.kill(1.5)', testInvalidSignalArgument, 1.5, 'other');82-test('Cannot use subprocess.kill(Infinity)', testInvalidSignalArgument, Number.POSITIVE_INFINITY, 'other');83-test('Cannot use subprocess.kill(NaN)', testInvalidSignalArgument, Number.NaN, 'other');82+test('Cannot use subprocess.kill(Infinity)', testInvalidSignalArgument, Infinity, 'other');83+test('Cannot use subprocess.kill(NaN)', testInvalidSignalArgument, NaN, 'other');84 test('Cannot use subprocess.kill(false)', testInvalidSignalArgument, false, 'other');85 test('Cannot use subprocess.kill(null)', testInvalidSignalArgument, null, 'other');86 test('Cannot use subprocess.kill(symbol)', testInvalidSignalArgument, Symbol('test'), 'other');87 test('Cannot use subprocess.kill({})', testInvalidSignalArgument, {}, 'other');modified:test/transform/encoding-final.js+1 added-1 removed
39 unmodified lines40 }41 };42 43 // This string gives different outputs with each encoding type44-const STRING_TO_ENCODE = '\u1000.';44+const STRING_TO_ENCODE = '\u{1000}.';45 const BUFFER_TO_ENCODE = Buffer.from(STRING_TO_ENCODE);46 47 test('can pass encoding "buffer" to stdout', checkEncoding, 'buffer', 1, execa);48 test('can pass encoding "utf8" to stdout', checkEncoding, 'utf8', 1, execa);81 unmodified linesmodified:test/transform/encoding-multibyte.js+1 added
20 unmodified lines21 });22 if (objectMode) {23 t.deepEqual(stdout, foobarArray);24 } else {25+ // eslint-disable-next-line n/prefer-global/buffer, unicorn/prefer-uint8array-base64 -- `Uint8Array#toBase64()` is not available on the minimum supported Node.js version26 t.is(stdout, Buffer.from(foobarArray.join('')).toString('base64'));27 }28 };29 51 unmodified linesmodified:test/transform/split-lines.js+1 added-1 removed
29 unmodified lines30 const emptyChunks = [emptyFull];31 const manyEmptyChunks = [emptyFull, emptyFull, emptyFull];32 const newlineFull = '\n';33 const newlineChunks = [newlineFull];34-const newlinesFull = '\n\n\n';34+const newlinesFull = '\n'.repeat(3);35 const newlinesChunks = [newlinesFull];36 const newlinesLines = ['\n', '\n', '\n'];37 const windowsNewlinesFull = '\r\n\r\n\r\n';38 const windowsNewlinesChunks = [windowsNewlinesFull];136 unmodified linesmodified:test/verbose/error.js+3 added-5 removed
1 import test from 'ava';2 import {setFixtureDirectory} from '../helpers/fixtures-directory.js';3-import {foobarString} from '../helpers/input.js';3+import {foobarString, foobarRed} from '../helpers/input.js';4 import {nestedSubprocess} from '../helpers/nested.js';5 import {6 QUOTE,7 runErrorSubprocess,18 unmodified lines26 } from '../helpers/verbose.js';27 28 setFixtureDirectory();29 30-const redFoobarString = `\u001B[31m${foobarString}\u001B[39m`;31-30 const testPrintError = async (t, verbose, isSync) => {31 const stderr = await runErrorSubprocess(t, verbose, isSync, getStdioForFd3Option(verbose));32 t.is(getErrorLine(stderr), `${testTimestamp} [0] × Command failed with exit code 2: noop-fail.js 1 ${foobarString}`);33 };115 unmodified lines149 ]);150 });151 152 test('Escapes and strips color sequences from error', async t => {155- const {stderr} = await t.throwsAsync(nestedSubprocess('noop-forever.js', [redFoobarString], {parentFixture: 'nested-fail.js', verbose: 'short'}));153+ const {stderr} = await t.throwsAsync(nestedSubprocess('noop-forever.js', [foobarRed], {parentFixture: 'nested-fail.js', verbose: 'short'}));154 t.deepEqual(getErrorLines(stderr), [155 `${testTimestamp} [0] × Command was killed with SIGTERM (Termination): noop-forever.js ${QUOTE}\\u001b[31m${foobarString}\\u001b[39m${QUOTE}`,156 `${testTimestamp} [0] × ${foobarString}`,157 ]);158 });159 160 test('Escapes control characters from error', async t => {163- const {stderr} = await t.throwsAsync(nestedSubprocess('noop-forever.js', ['\u0001'], {parentFixture: 'nested-fail.js', verbose: 'short'}));161+ const {stderr} = await t.throwsAsync(nestedSubprocess('noop-forever.js', ['\u{1}'], {parentFixture: 'nested-fail.js', verbose: 'short'}));162 t.deepEqual(getErrorLines(stderr), [163 `${testTimestamp} [0] × Command was killed with SIGTERM (Termination): noop-forever.js ${QUOTE}\\u0001${QUOTE}`,164 `${testTimestamp} [0] × \\u0001`,165 ]);1 unmodified linemodified:test/verbose/ipc.js+6 added-4 removed
1 import {on} from 'node:events';2 import {inspect} from 'node:util';3 import test from 'ava';4-import {red} from 'yoctocolors';4 import {execa} from '../../index.js';5 import {setFixtureDirectory} from '../helpers/fixtures-directory.js';7-import {foobarString, foobarObject} from '../helpers/input.js';6+import {foobarString, foobarRed, foobarObject} from '../helpers/input.js';7 import {nestedSubprocess, nestedInstance} from '../helpers/nested.js';8 import {fullStdio} from '../helpers/stdio.js';9 import {10 getIpcLine,86 unmodified lines97 t.is(getIpcLine(stderr), `${testTimestamp} [0] * ã`);98 });99 100 test('Strips color sequences from IPC', async t => {102- const {stderr} = await nestedSubprocess('ipc-send.js', [red(foobarString)], {ipc: true, verbose: 'full'}, {env: {FORCE_COLOR: '1', NO_COLOR: undefined}});101+ const {stderr} = await nestedSubprocess('ipc-send.js', [foobarRed], {ipc: true, verbose: 'full'});102 t.is(getIpcLine(stderr), `${testTimestamp} [0] * ${foobarString}`);103 });104 105 test('Escapes control characters from IPC', async t => {107- const {stderr} = await nestedSubprocess('ipc-send.js', ['\u0001'], {ipc: true, verbose: 'full'});106+ const {stderr} = await nestedSubprocess('ipc-send.js', ['\u{1}'], {ipc: true, verbose: 'full'});107 t.is(getIpcLine(stderr), `${testTimestamp} [0] * \\u0001`);108 });109 110 test('Prints IPC progressively', async t => {111+ t.plan(2);112+113 const subprocess = nestedInstance('ipc-send-forever.js', {ipc: true, verbose: 'full'});114 for await (const chunk of on(subprocess.stderr, 'data')) {115 const ipcLine = getIpcLine(chunk.toString());116 if (ipcLine !== undefined) {117+ // eslint-disable-next-line ava/no-conditional-assertion -- `t.plan()` ensures this always executes118 t.is(ipcLine, `${testTimestamp} [0] * ${foobarString}`);119 break;120 }121 }4 unmodified linesmodified:test/verbose/log.js+1 added-2 removed
28 unmodified lines29 test('Prints without colors if not supported', testColor, false, '0');30 31 test.serial('Prints lines in order when interleaved with subprocess stderr', async t => {32 const results = await Promise.all(Array.from({length: PARALLEL_COUNT}, () =>33- nestedSubprocess('noop-fd.js', ['2', `${foobarString}\n`], {verbose: 'full', stderr: 'inherit'}, {all: true}),34- ));33+ nestedSubprocess('noop-fd.js', ['2', `${foobarString}\n`], {verbose: 'full', stderr: 'inherit'}, {all: true})));34 for (const {all} of results) {35 t.deepEqual(36 getNormalizedLines(all),37 [getCommandLine(all), foobarString, getCompletionLine(all)],3 unmodified linesmodified:test/verbose/output-enable.js+3 added-4 removed
1 import test from 'ava';2-import {red} from 'yoctocolors';2 import {setFixtureDirectory} from '../helpers/fixtures-directory.js';4-import {foobarString, foobarUtf16Uint8Array} from '../helpers/input.js';3+import {foobarString, foobarRed, foobarUtf16Uint8Array} from '../helpers/input.js';4 import {fullStdio} from '../helpers/stdio.js';5 import {nestedSubprocess} from '../helpers/nested.js';6 import {7 runErrorSubprocess,96 unmodified lines104 t.is(getOutputLine(stderr), `${testTimestamp} [0] ã`);105 });106 107 test('Strips color sequences from stdout', async t => {109- const {stderr} = await nestedSubprocess('noop.js', [red(foobarString)], {verbose: 'full'}, {env: {FORCE_COLOR: '1', NO_COLOR: undefined}});108+ const {stderr} = await nestedSubprocess('noop.js', [foobarRed], {verbose: 'full'});109 t.is(getOutputLine(stderr), `${testTimestamp} [0] ${foobarString}`);110 });111 112 test('Escapes control characters from stdout', async t => {114- const {stderr} = await nestedSubprocess('noop.js', ['\u0001'], {verbose: 'full'});113+ const {stderr} = await nestedSubprocess('noop.js', ['\u{1}'], {verbose: 'full'});114 t.is(getOutputLine(stderr), `${testTimestamp} [0] \\u0001`);115 });116 117 const testStdioSame = async (t, fdNumber) => {27 unmodified linesmodified:test/verbose/output-progressive.js+3 added
6 unmodified lines7 8 setFixtureDirectory();9 10 test('Prints stdout one line at a time', async t => {11+ t.plan(1);12+13 const subprocess = nestedInstance('noop-progressive.js', [foobarString], {verbose: 'full'});14 15 for await (const chunk of on(subprocess.stderr, 'data')) {16 const outputLine = getOutputLine(chunk.toString().trim());17 if (outputLine !== undefined) {18+ // eslint-disable-next-line ava/no-conditional-assertion -- `t.plan()` ensures this always executes19 t.is(outputLine, `${testTimestamp} [0] ${foobarString}`);20 break;21 }22 }39 unmodified linesmodified:test/verbose/start.js+3 added-5 removed
1 import test from 'ava';2 import {setFixtureDirectory} from '../helpers/fixtures-directory.js';3-import {foobarString} from '../helpers/input.js';3+import {foobarString, foobarRed} from '../helpers/input.js';4 import {nestedSubprocess} from '../helpers/nested.js';5 import {6 QUOTE,7 runErrorSubprocess,18 unmodified lines26 } from '../helpers/verbose.js';27 28 setFixtureDirectory();29 30-const redFoobarString = `\u001B[31m${foobarString}\u001B[39m`;31-30 const testPrintCommand = async (t, verbose, worker, isSync) => {31 const {stderr} = await nestedSubprocess('noop.js', [foobarString], {32 verbose,33 ...getStdioForFd3Option(verbose),122 unmodified lines156 t.is(getCommandLine(stderr), `${testTimestamp} [0] $ noop.js ${QUOTE}ã${QUOTE}`);157 });158 159 test('Escapes color sequences from command', async t => {162- const {stderr} = await nestedSubprocess('noop.js', [redFoobarString], {verbose: 'short'});160+ const {stderr} = await nestedSubprocess('noop.js', [foobarRed], {verbose: 'short'});161 t.true(getCommandLine(stderr).includes(`${QUOTE}\\u001b[31m${foobarString}\\u001b[39m${QUOTE}`));162 });163 164 test('Escapes control characters from command', async t => {167- const {stderr} = await nestedSubprocess('noop.js', ['\u0001'], {verbose: 'short'});165+ const {stderr} = await nestedSubprocess('noop.js', ['\u{1}'], {verbose: 'short'});166 t.is(getCommandLine(stderr), `${testTimestamp} [0] $ noop.js ${QUOTE}\\u0001${QUOTE}`);167 });modified:test-d/arguments/encoding-option.test-d.ts+1 added-1 removed
1 unmodified line2 import {execa, execaSync} from '../../index.js';3 4 await execa('unicorns', {encoding: 'utf8'});5 execaSync('unicorns', {encoding: 'utf8'});6-/* eslint-disable unicorn/text-encoding-identifier-case */6+/* eslint-disable unicorn/text-encoding-identifier-case -- intentionally testing invalid encoding casing */7 expectError(await execa('unicorns', {encoding: 'utf-8'}));8 expectError(execaSync('unicorns', {encoding: 'utf-8'}));9 expectError(await execa('unicorns', {encoding: 'UTF8'}));10 expectError(execaSync('unicorns', {encoding: 'UTF8'}));38 unmodified linesmodified:test-d/arguments/options.test-d.ts+25 added-25 removed
23 unmodified lines24 expectError(execaSync('unicorns', {preferLocal: 'false'}));25 26 await execa('unicorns', {localDir: '.'});27 execaSync('unicorns', {localDir: '.'});28-await execa('unicorns', {localDir: '.' as string});29-execaSync('unicorns', {localDir: '.' as string});28+await execa('unicorns', {localDir: '.'});29+execaSync('unicorns', {localDir: '.'});30 await execa('unicorns', {localDir: fileUrl});31 execaSync('unicorns', {localDir: fileUrl});32 expectError(await execa('unicorns', {localDir: false}));33 expectError(execaSync('unicorns', {localDir: false}));6 unmodified lines40 expectError(execaSync('unicorns', {node: 'true'}));41 42 await execa('unicorns', {nodePath: './node'});43 execaSync('unicorns', {nodePath: './node'});44-await execa('unicorns', {nodePath: './node' as string});45-execaSync('unicorns', {nodePath: './node' as string});44+await execa('unicorns', {nodePath: './node'});45+execaSync('unicorns', {nodePath: './node'});46 await execa('unicorns', {nodePath: fileUrl});47 execaSync('unicorns', {nodePath: fileUrl});48 expectError(await execa('unicorns', {nodePath: false}));49 expectError(execaSync('unicorns', {nodePath: false}));6 unmodified lines56 expectError(execaSync('unicorns', {nodeOptions: [false] as const}));57 58 await execa('unicorns', {input: ''});59 execaSync('unicorns', {input: ''});60-await execa('unicorns', {input: '' as string});61-execaSync('unicorns', {input: '' as string});60+await execa('unicorns', {input: ''});61+execaSync('unicorns', {input: ''});62 await execa('unicorns', {input: new Uint8Array()});63 execaSync('unicorns', {input: new Uint8Array()});64 await execa('unicorns', {input: process.stdin});65 execaSync('unicorns', {input: process.stdin});1 unmodified line67 expectError(execaSync('unicorns', {input: false}));68 69 await execa('unicorns', {inputFile: ''});70 execaSync('unicorns', {inputFile: ''});71-await execa('unicorns', {inputFile: '' as string});72-execaSync('unicorns', {inputFile: '' as string});71+await execa('unicorns', {inputFile: ''});72+execaSync('unicorns', {inputFile: ''});73 await execa('unicorns', {inputFile: fileUrl});74 execaSync('unicorns', {inputFile: fileUrl});75 expectError(await execa('unicorns', {inputFile: false}));76 expectError(execaSync('unicorns', {inputFile: false}));27 unmodified lines104 expectError(execaSync('unicorns', {extendEnv: 'false'}));105 106 await execa('unicorns', {cwd: '.'});107 execaSync('unicorns', {cwd: '.'});108-await execa('unicorns', {cwd: '.' as string});109-execaSync('unicorns', {cwd: '.' as string});108+await execa('unicorns', {cwd: '.'});109+execaSync('unicorns', {cwd: '.'});110 await execa('unicorns', {cwd: fileUrl});111 execaSync('unicorns', {cwd: fileUrl});112 expectError(await execa('unicorns', {cwd: false}));113 expectError(execaSync('unicorns', {cwd: false}));114 115-/* eslint-disable @typescript-eslint/naming-convention */115+/* eslint-disable @typescript-eslint/naming-convention -- `PATH` is a real environment variable name */116 await execa('unicorns', {env: {PATH: ''}});117 execaSync('unicorns', {env: {PATH: ''}});118 const env: Record<string, string> = {PATH: ''};119 await execa('unicorns', {env});3 unmodified lines123 expectError(execaSync('unicorns', {env: false}));124 125 await execa('unicorns', {argv0: ''});126 execaSync('unicorns', {argv0: ''});127-await execa('unicorns', {argv0: '' as string});128-execaSync('unicorns', {argv0: '' as string});127+await execa('unicorns', {argv0: ''});128+execaSync('unicorns', {argv0: ''});129 expectError(await execa('unicorns', {argv0: false}));130 expectError(execaSync('unicorns', {argv0: false}));131 132 await execa('unicorns', {uid: 0});133 execaSync('unicorns', {uid: 0});134-await execa('unicorns', {uid: 0 as number});135-execaSync('unicorns', {uid: 0 as number});134+await execa('unicorns', {uid: 0});135+execaSync('unicorns', {uid: 0});136 expectError(await execa('unicorns', {uid: '0'}));137 expectError(execaSync('unicorns', {uid: '0'}));138 139 await execa('unicorns', {gid: 0});140 execaSync('unicorns', {gid: 0});141-await execa('unicorns', {gid: 0 as number});142-execaSync('unicorns', {gid: 0 as number});141+await execa('unicorns', {gid: 0});142+execaSync('unicorns', {gid: 0});143 expectError(await execa('unicorns', {gid: '0'}));144 expectError(execaSync('unicorns', {gid: '0'}));145 146 await execa('unicorns', {shell: true});1 unmodified line148 await execa('unicorns', {shell: true as boolean});149 execaSync('unicorns', {shell: true as boolean});150 await execa('unicorns', {shell: '/bin/sh'});151 execaSync('unicorns', {shell: '/bin/sh'});152-await execa('unicorns', {shell: '/bin/sh' as string});153-execaSync('unicorns', {shell: '/bin/sh' as string});152+await execa('unicorns', {shell: '/bin/sh'});153+execaSync('unicorns', {shell: '/bin/sh'});154 await execa('unicorns', {shell: fileUrl});155 execaSync('unicorns', {shell: fileUrl});156 expectError(await execa('unicorns', {shell: {}}));157 expectError(execaSync('unicorns', {shell: {}}));158 159 await execa('unicorns', {timeout: 1000});160 execaSync('unicorns', {timeout: 1000});161-await execa('unicorns', {timeout: 1000 as number});162-execaSync('unicorns', {timeout: 1000 as number});161+await execa('unicorns', {timeout: 1000});162+execaSync('unicorns', {timeout: 1000});163 expectError(await execa('unicorns', {timeout: '1000'}));164 expectError(execaSync('unicorns', {timeout: '1000'}));165 166 await execa('unicorns', {maxBuffer: 1000});167 execaSync('unicorns', {maxBuffer: 1000});168-await execa('unicorns', {maxBuffer: 1000 as number});169-execaSync('unicorns', {maxBuffer: 1000 as number});168+await execa('unicorns', {maxBuffer: 1000});169+execaSync('unicorns', {maxBuffer: 1000});170 expectError(await execa('unicorns', {maxBuffer: '1000'}));171 expectError(execaSync('unicorns', {maxBuffer: '1000'}));172 173 await execa('unicorns', {killSignal: 'SIGTERM'});1 unmodified line175 expectError(await execa('unicorns', {killSignal: 'SIGTERM' as string}));176 expectError(execaSync('unicorns', {killSignal: 'SIGTERM' as string}));177 await execa('unicorns', {killSignal: 9});178 execaSync('unicorns', {killSignal: 9});179-await execa('unicorns', {killSignal: 9 as number});180-execaSync('unicorns', {killSignal: 9 as number});179+await execa('unicorns', {killSignal: 9});180+execaSync('unicorns', {killSignal: 9});181 expectError(await execa('unicorns', {killSignal: false}));182 expectError(execaSync('unicorns', {killSignal: false}));183 expectError(await execa('unicorns', {killSignal: 'Sigterm'}));184 expectError(execaSync('unicorns', {killSignal: 'Sigterm'}));104 unmodified linesmodified:test-d/arguments/specific.test-d.ts+10 added
7 unmodified lines8 await execa('unicorns', {maxBuffer: {stdout: 0, stderr: 0} as const});9 await execa('unicorns', {maxBuffer: {all: 0}});10 await execa('unicorns', {maxBuffer: {fd1: 0}});11 await execa('unicorns', {maxBuffer: {fd2: 0}});12+await execa('unicorns', {maxBuffer: {fd3: 0}});13 await execa('unicorns', {maxBuffer: {fd3: 0}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});14 await execa('unicorns', {maxBuffer: {ipc: 0}});15 expectError(await execa('unicorns', {maxBuffer: {stdout: '0'}}));16 4 unmodified lines21 execaSync('unicorns', {maxBuffer: {stdout: 0, stderr: 0} as const});22 execaSync('unicorns', {maxBuffer: {all: 0}});23 execaSync('unicorns', {maxBuffer: {fd1: 0}});24 execaSync('unicorns', {maxBuffer: {fd2: 0}});25+execaSync('unicorns', {maxBuffer: {fd3: 0}});26 execaSync('unicorns', {maxBuffer: {fd3: 0}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});27 execaSync('unicorns', {maxBuffer: {ipc: 0}});28 expectError(execaSync('unicorns', {maxBuffer: {stdout: '0'}}));29 4 unmodified lines34 await execa('unicorns', {verbose: {stdout: 'none', stderr: 'none'} as const});35 await execa('unicorns', {verbose: {all: 'none'}});36 await execa('unicorns', {verbose: {fd1: 'none'}});37 await execa('unicorns', {verbose: {fd2: 'none'}});38+await execa('unicorns', {verbose: {fd3: 'none'}});39 await execa('unicorns', {verbose: {fd3: 'none'}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});40 await execa('unicorns', {verbose: {ipc: 'none'}});41 expectError(await execa('unicorns', {verbose: {stdout: 'other'}}));42 4 unmodified lines47 execaSync('unicorns', {verbose: {stdout: 'none', stderr: 'none'} as const});48 execaSync('unicorns', {verbose: {all: 'none'}});49 execaSync('unicorns', {verbose: {fd1: 'none'}});50 execaSync('unicorns', {verbose: {fd2: 'none'}});51+execaSync('unicorns', {verbose: {fd3: 'none'}});52 execaSync('unicorns', {verbose: {fd3: 'none'}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});53 execaSync('unicorns', {verbose: {ipc: 'none'}});54 expectError(execaSync('unicorns', {verbose: {stdout: 'other'}}));55 4 unmodified lines60 await execa('unicorns', {stripFinalNewline: {stdout: true, stderr: true} as const});61 await execa('unicorns', {stripFinalNewline: {all: true}});62 await execa('unicorns', {stripFinalNewline: {fd1: true}});63 await execa('unicorns', {stripFinalNewline: {fd2: true}});64+await execa('unicorns', {stripFinalNewline: {fd3: true}});65 await execa('unicorns', {stripFinalNewline: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});66 await execa('unicorns', {stripFinalNewline: {ipc: true}});67 expectError(await execa('unicorns', {stripFinalNewline: {stdout: 'true'}}));68 4 unmodified lines73 execaSync('unicorns', {stripFinalNewline: {stdout: true, stderr: true} as const});74 execaSync('unicorns', {stripFinalNewline: {all: true}});75 execaSync('unicorns', {stripFinalNewline: {fd1: true}});76 execaSync('unicorns', {stripFinalNewline: {fd2: true}});77+execaSync('unicorns', {stripFinalNewline: {fd3: true}});78 execaSync('unicorns', {stripFinalNewline: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});79 execaSync('unicorns', {stripFinalNewline: {ipc: true}});80 expectError(execaSync('unicorns', {stripFinalNewline: {stdout: 'true'}}));81 4 unmodified lines86 await execa('unicorns', {lines: {stdout: true, stderr: true} as const});87 await execa('unicorns', {lines: {all: true}});88 await execa('unicorns', {lines: {fd1: true}});89 await execa('unicorns', {lines: {fd2: true}});90+await execa('unicorns', {lines: {fd3: true}});91 await execa('unicorns', {lines: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});92 await execa('unicorns', {lines: {ipc: true}});93 expectError(await execa('unicorns', {lines: {stdout: 'true'}}));94 4 unmodified lines99 execaSync('unicorns', {lines: {stdout: true, stderr: true} as const});100 execaSync('unicorns', {lines: {all: true}});101 execaSync('unicorns', {lines: {fd1: true}});102 execaSync('unicorns', {lines: {fd2: true}});103+execaSync('unicorns', {lines: {fd3: true}});104 execaSync('unicorns', {lines: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});105 execaSync('unicorns', {lines: {ipc: true}});106 expectError(execaSync('unicorns', {lines: {stdout: 'true'}}));107 4 unmodified lines112 await execa('unicorns', {buffer: {stdout: true, stderr: true} as const});113 await execa('unicorns', {buffer: {all: true}});114 await execa('unicorns', {buffer: {fd1: true}});115 await execa('unicorns', {buffer: {fd2: true}});116+await execa('unicorns', {buffer: {fd3: true}});117 await execa('unicorns', {buffer: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});118 await execa('unicorns', {buffer: {ipc: true}});119 expectError(await execa('unicorns', {buffer: {stdout: 'true'}}));120 4 unmodified lines125 execaSync('unicorns', {buffer: {stdout: true, stderr: true} as const});126 execaSync('unicorns', {buffer: {all: true}});127 execaSync('unicorns', {buffer: {fd1: true}});128 execaSync('unicorns', {buffer: {fd2: true}});129+execaSync('unicorns', {buffer: {fd3: true}});130 execaSync('unicorns', {buffer: {fd3: true}, stdio: ['pipe', 'pipe', 'pipe', 'pipe']});131 execaSync('unicorns', {buffer: {ipc: true}});132 expectError(execaSync('unicorns', {buffer: {stdout: 'true'}}));133 36 unmodified linesmodified:test-d/ipc/message.test-d.ts+8 added-8 removed
60 unmodified lines61 expectAssignable<Message>(null);62 expectAssignable<Message<'advanced'>>(null);63 expectAssignable<Message<'json'>>(null);64 65-await sendMessage(Number.NaN);66-expectAssignable<Message>(Number.NaN);67-expectAssignable<Message<'advanced'>>(Number.NaN);68-expectAssignable<Message<'json'>>(Number.NaN);65+await sendMessage(NaN);66+expectAssignable<Message>(NaN);67+expectAssignable<Message<'advanced'>>(NaN);68+expectAssignable<Message<'json'>>(NaN);69 70-await sendMessage(Number.POSITIVE_INFINITY);71-expectAssignable<Message>(Number.POSITIVE_INFINITY);72-expectAssignable<Message<'advanced'>>(Number.POSITIVE_INFINITY);73-expectAssignable<Message<'json'>>(Number.POSITIVE_INFINITY);70+await sendMessage(Infinity);71+expectAssignable<Message>(Infinity);72+expectAssignable<Message<'advanced'>>(Infinity);73+expectAssignable<Message<'json'>>(Infinity);74 75 await sendMessage(new Map());76 expectAssignable<Message>(new Map());77 expectAssignable<Message<'advanced'>>(new Map());56 unmodified linesmodified:test-d/stdio/option/fd-integer-0.test-d.ts+4 added-4 removed
36 unmodified lines37 expectAssignable<StdinSyncOption>([0]);38 39 expectNotAssignable<StdinOption>(0.5);40 expectNotAssignable<StdinSyncOption>(-1);41-expectNotAssignable<StdinOption>(Number.POSITIVE_INFINITY);42-expectNotAssignable<StdinSyncOption>(Number.NaN);41+expectNotAssignable<StdinOption>(Infinity);42+expectNotAssignable<StdinSyncOption>(NaN);43 44 expectNotAssignable<StdoutStderrOption>(0);45 expectNotAssignable<StdoutStderrSyncOption>(0);46 expectNotAssignable<StdoutStderrOption>([0]);47 expectNotAssignable<StdoutStderrSyncOption>([0]);48 49 expectNotAssignable<StdoutStderrOption>(0.5);50 expectNotAssignable<StdoutStderrSyncOption>(-1);51-expectNotAssignable<StdoutStderrOption>(Number.POSITIVE_INFINITY);52-expectNotAssignable<StdoutStderrSyncOption>(Number.NaN);51+expectNotAssignable<StdoutStderrOption>(Infinity);52+expectNotAssignable<StdoutStderrSyncOption>(NaN);modified:types/arguments/encoding-option.d.ts+8 added-8 removed
1 type DefaultEncodingOption = 'utf8';2 type TextEncodingOption =3- | DefaultEncodingOption4- | 'utf16le';3+ | DefaultEncodingOption4+ | 'utf16le';5 6 export type BufferEncodingOption = 'buffer';7 export type BinaryEncodingOption =8- | BufferEncodingOption9- | 'hex'10- | 'base64'11- | 'base64url'12- | 'latin1'13- | 'ascii';8+ | BufferEncodingOption9+ | 'hex'10+ | 'base64'11+ | 'base64url'12+ | 'latin1'13+ | 'ascii';14 15 // `options.encoding`16 export type EncodingOption =17 | TextEncodingOption4 unmodified linesmodified:types/arguments/options.d.ts+1 added-1 removed
148 unmodified lines149 If the subprocess outputs text, specifies its character encoding, either [`'utf8'`](https://en.wikipedia.org/wiki/UTF-8) or [`'utf16le'`](https://en.wikipedia.org/wiki/UTF-16).150 151 If it outputs binary data instead, this should be either:152 - `'buffer'`: returns the binary output as an `Uint8Array`.153- - [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#URL_applications), [`'latin1'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) or [`'ascii'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings): encodes the binary output as a string.153+ - [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#RFC_4648), [`'latin1'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) or [`'ascii'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings): encodes the binary output as a string.154 155 The output is available with `result.stdout`, `result.stderr` and `result.stdio`.156 157 @default 'utf8'245 unmodified linesmodified:types/arguments/specific.d.ts+1 added-3 removed
1 unmodified line2 3 // Options which can be fd-specific like `{verbose: {stdout: 'none', stderr: 'full'}}`4 export type FdGenericOption<OptionType> = OptionType | GenericOptionObject<OptionType>;5 6-type GenericOptionObject<OptionType> = {7- readonly [FdName in GenericFromOption]?: OptionType8-};6+type GenericOptionObject<OptionType> = Readonly<Partial<Record<GenericFromOption, OptionType>>>;7 8 type GenericFromOption = FromOption | 'ipc';9 10 // Retrieve fd-specific option's value44 unmodified linesmodified:types/return/final-error.d.ts+7 added-7 removed
18 unmodified lines19 > = NonNullable<CommonResult<IsSync, OptionsType>[PropertyName]>;20 21 // `result.*` defined only on failure, i.e. on `error.*`22 export type ErrorProperties =23- | 'name'24- | 'message'25- | 'stack'26- | 'cause'27- | 'shortMessage'28- | 'originalMessage'29- | 'code';23+ | 'name'24+ | 'message'25+ | 'stack'26+ | 'cause'27+ | 'shortMessage'28+ | 'originalMessage'29+ | 'code';30 31 /**32 Result of a subprocess failed execution.33 20 unmodified linesmodified:types/return/result-all.d.ts+4 added-4 removed
11 unmodified lines12 AllOption extends CommonOptions['all'],13 OptionsType extends CommonOptions,14 > = AllOption extends true15 ? ResultStdio<16- AllMainFd<OptionsType>,17- AllObjectFd<OptionsType>,18- AllLinesFd<OptionsType>,19- OptionsType16+ AllMainFd<OptionsType>,17+ AllObjectFd<OptionsType>,18+ AllLinesFd<OptionsType>,19+ OptionsType20 >21 : undefined;22 23 type AllMainFd<OptionsType extends CommonOptions> =9 unmodified linesmodified:types/return/result-ipc.d.ts+3 added-3 removed
9 unmodified lines10 OptionsType extends CommonOptions,11 > = IsSync extends true12 ? []13 : ResultIpcAsync<14- FdSpecificOption<OptionsType['buffer'], 'ipc'>,15- HasIpc<StricterOptions<OptionsType, Options>>,16- OptionsType['serialization']14+ FdSpecificOption<OptionsType['buffer'], 'ipc'>,15+ HasIpc<StricterOptions<OptionsType, Options>>,16+ OptionsType['serialization']17 >;18 19 type ResultIpcAsync<20 BufferOption extends boolean | undefined,9 unmodified linesmodified:types/return/result-stdio.d.ts+2 added-2 removed
9 unmodified lines10 StdioOptionsArrayType,11 OptionsType extends CommonOptions,12 > = {13 -readonly [FdNumber in keyof StdioOptionsArrayType]: ResultStdioNotAll<14- FdNumber extends string ? FdNumber : string,15- OptionsType14+ FdNumber extends string ? FdNumber : string,15+ OptionsType16 >17 };18 19 export {};modified:types/return/result-stdout.d.ts+7 added-7 removed
15 unmodified lines16 ObjectFdNumber extends string,17 LinesFdNumber extends string,18 OptionsType extends CommonOptions,19 > = ResultStdioProperty<20-ObjectFdNumber,21-LinesFdNumber,22-IgnoresResultOutput<MainFdNumber, OptionsType>,23-OptionsType20+ ObjectFdNumber,21+ LinesFdNumber,22+ IgnoresResultOutput<MainFdNumber, OptionsType>,23+ OptionsType24 >;25 26 type ResultStdioProperty<27 ObjectFdNumber extends string,2 unmodified lines30 OptionsType extends CommonOptions,31 > = StreamOutputIgnored extends true32 ? undefined33 : ResultStdioItem<34- IsObjectFd<ObjectFdNumber, OptionsType>,35- FdSpecificOption<OptionsType['lines'], LinesFdNumber>,36- OptionsType['encoding']34+ IsObjectFd<ObjectFdNumber, OptionsType>,35+ FdSpecificOption<OptionsType['lines'], LinesFdNumber>,36+ OptionsType['encoding']37 >;38 39 type ResultStdioItem<40 IsObjectResult,12 unmodified linesmodified:types/return/result.d.ts+1 added-3 removed
182 unmodified lines183 IsSync extends boolean = boolean,184 OptionsType extends CommonOptions = CommonOptions,185 > = InstanceType<typeof CommonResult<IsSync, OptionsType>> & OmitErrorIfReject<OptionsType['reject']>;186 187-type OmitErrorIfReject<RejectOption extends CommonOptions['reject']> = {188- [ErrorProperty in ErrorProperties]: RejectOption extends false ? unknown : never189-};187+type OmitErrorIfReject<RejectOption extends CommonOptions['reject']> = Record<ErrorProperties, RejectOption extends false ? unknown : never>;188 189 /**190 Result of a subprocess successful execution.191 12 unmodified linesmodified:types/stdio/type.d.ts+6 added-13 removed
45 unmodified lines46 IsSync extends boolean,47 IsExtra extends boolean,48 IsArray extends boolean,49 > =50- | SimpleStdioOption<IsSync, IsExtra, IsArray>51- | URL52- | {readonly file: string; readonly append?: boolean}53- | GeneratorTransform<IsSync>54- | GeneratorTransformFull<IsSync>55- | Unless<And<Not<IsSync>, IsArray>, 3 | 4 | 5 | 6 | 7 | 8 | 9>56- | Unless<Or<IsSync, IsArray>, 'ipc'>57- | Unless<IsSync, DuplexTransform | WebTransform | TransformStream>;50+ SimpleStdioOption<IsSync, IsExtra, IsArray> | URL | GeneratorTransform<IsSync> | GeneratorTransformFull<IsSync> | Unless<And<Not<IsSync>, IsArray>, 3 | 4 | 5 | 6 | 7 | 8 | 9> | Unless<Or<IsSync, IsArray>, 'ipc'> | Unless<IsSync, DuplexTransform | WebTransform | TransformStream> | {readonly file: string; readonly append?: boolean};51 52 // Synchronous iterables excluding strings, Uint8Arrays and Arrays53 type IterableObject<IsArray extends boolean> = Iterable<unknown>61-& object62-& {readonly BYTES_PER_ELEMENT?: never}63-& AndUnless<IsArray, {readonly lastIndexOf?: never}>;54+ & object55+ & AndUnless<IsArray, {readonly lastIndexOf?: never}>56+ & {readonly BYTES_PER_ELEMENT?: never};57 58 // `process.stdin|stdout|stderr` are `Duplex` with a `fd` property.59 // This ensures they can only be passed to `stdin`/`stdout`/`stderr`, based on their direction.60 type ProcessStdinFd = {readonly fd?: 0};47 unmodified lines108 IsSync extends boolean,109 IsExtra extends boolean,110 IsArray extends boolean,111 > =119- | CommonStdioOption<IsSync, IsExtra, IsArray>120- | OutputStdioOption<IsSync, IsArray>;112+ | CommonStdioOption<IsSync, IsExtra, IsArray>113+ | OutputStdioOption<IsSync, IsArray>;114 115 // `options.stdout|stderr`116 export type StdoutStderrOptionCommon<117 IsSync extends boolean = boolean,48 unmodified linesmodified:types/subprocess/subprocess.d.ts+64 added-63 removed
13 unmodified lines14 import type {SubprocessStdioStream} from './stdout.js';15 import type {SubprocessStdioArray} from './stdio.js';16 import type {SubprocessAll} from './all.js';17 18-type ExecaCustomSubprocess<OptionsType extends Options> = {19- /**20- Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).18+type ExecaCustomSubprocess<OptionsType extends Options> =19+ & IpcMethods<HasIpc<OptionsType>, OptionsType['serialization']>20+ & PipableSubprocess21+ & {22+ /**23+ Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).24 22- This is `undefined` if the subprocess failed to spawn.23- */24- pid?: number;25+ This is `undefined` if the subprocess failed to spawn.26+ */27+ pid?: number;28 26- /**27- The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.29+ /**30+ The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.31 29- This is `null` if the `stdin` option is set to `'inherit'`, `'ignore'`, `Readable` or `integer`.30- */31- stdin: SubprocessStdioStream<'0', OptionsType>;32+ This is `null` if the `stdin` option is set to `'inherit'`, `'ignore'`, `Readable` or `integer`.33+ */34+ stdin: SubprocessStdioStream<'0', OptionsType>;35 33- /**34- The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.36+ /**37+ The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.38 36- This is `null` if the `stdout` option is set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.37- */38- stdout: SubprocessStdioStream<'1', OptionsType>;39+ This is `null` if the `stdout` option is set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.40+ */41+ stdout: SubprocessStdioStream<'1', OptionsType>;42 40- /**41- The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.43+ /**44+ The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.45 43- This is `null` if the `stderr` option is set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.44- */45- stderr: SubprocessStdioStream<'2', OptionsType>;46+ This is `null` if the `stderr` option is set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.47+ */48+ stderr: SubprocessStdioStream<'2', OptionsType>;49 47- /**48- Stream combining/interleaving `subprocess.stdout` and `subprocess.stderr`.50+ /**51+ Stream combining/interleaving `subprocess.stdout` and `subprocess.stderr`.52 50- This requires the `all` option to be `true`.53+ This requires the `all` option to be `true`.54 52- This is `undefined` if `stdout` and `stderr` options are set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.53- */54- all: SubprocessAll<OptionsType>;55+ This is `undefined` if `stdout` and `stderr` options are set to `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.56+ */57+ all: SubprocessAll<OptionsType>;58 56- /**57- The subprocess `stdin`, `stdout`, `stderr` and other files descriptors as an array of streams.59+ /**60+ The subprocess `stdin`, `stdout`, `stderr` and other files descriptors as an array of streams.61 59- Each array item is `null` if the corresponding `stdin`, `stdout`, `stderr` or `stdio` option is set to `'inherit'`, `'ignore'`, `Stream` or `integer`, or if the `buffer` option is `false`.60- */61- stdio: SubprocessStdioArray<OptionsType>;62+ Each array item is `null` if the corresponding `stdin`, `stdout`, `stderr` or `stdio` option is set to `'inherit'`, `'ignore'`, `Stream` or `integer`, or if the `buffer` option is `false`.63+ */64+ stdio: SubprocessStdioArray<OptionsType>;65 63- /**64- Sends a [signal](https://nodejs.org/api/os.html#signal-constants) to the subprocess. The default signal is the `killSignal` option. `killSignal` defaults to `SIGTERM`, which terminates the subprocess.66+ /**67+ Sends a [signal](https://nodejs.org/api/os.html#signal-constants) to the subprocess. The default signal is the `killSignal` option. `killSignal` defaults to `SIGTERM`, which terminates the subprocess.68 66- This returns `false` when the signal could not be sent, for example when the subprocess has already exited.69+ This returns `false` when the signal could not be sent, for example when the subprocess has already exited.70 68- When an error is passed as argument, it is set to the subprocess' `error.cause`. The subprocess is then terminated with the default signal. This does not emit the [`error` event](https://nodejs.org/api/child_process.html#event-error).71+ When an error is passed as argument, it is set to the subprocess' `error.cause`. The subprocess is then terminated with the default signal. This does not emit the [`error` event](https://nodejs.org/api/child_process.html#event-error).72 70- [More info.](https://nodejs.org/api/child_process.html#subprocesskillsignal)71- */72- kill(signal?: keyof SignalConstants | number, error?: Error): boolean;73- kill(error?: Error): boolean;73+ [More info.](https://nodejs.org/api/child_process.html#subprocesskillsignal)74+ */75+ kill(signal?: keyof SignalConstants | number, error?: Error): boolean;76+ kill(error?: Error): boolean;77 75- /**76- Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.77- */78- [Symbol.asyncIterator](): SubprocessAsyncIterable<undefined, OptionsType['encoding']>;78+ /**79+ Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.80+ */81+ [Symbol.asyncIterator](): SubprocessAsyncIterable<undefined, OptionsType['encoding']>;82 80- /**81- Same as `subprocess[Symbol.asyncIterator]` except options can be provided.82- */83- iterable<IterableOptions extends ReadableOptions = {}>(readableOptions?: IterableOptions): SubprocessAsyncIterable<IterableOptions['binary'], OptionsType['encoding']>;83+ /**84+ Same as `subprocess[Symbol.asyncIterator]` except options can be provided.85+ */86+ iterable<IterableOptions extends ReadableOptions = {}>(readableOptions?: IterableOptions): SubprocessAsyncIterable<IterableOptions['binary'], OptionsType['encoding']>;87 85- /**86- Converts the subprocess to a readable stream.87- */88- readable(readableOptions?: ReadableOptions): Readable;88+ /**89+ Converts the subprocess to a readable stream.90+ */91+ readable(readableOptions?: ReadableOptions): Readable;92 90- /**91- Converts the subprocess to a writable stream.92- */93- writable(writableOptions?: WritableOptions): Writable;93+ /**94+ Converts the subprocess to a writable stream.95+ */96+ writable(writableOptions?: WritableOptions): Writable;97 95- /**96- Converts the subprocess to a duplex stream.97- */98- duplex(duplexOptions?: DuplexOptions): Duplex;99-}100-& IpcMethods<HasIpc<OptionsType>, OptionsType['serialization']>101-& PipableSubprocess;98+ /**99+ Converts the subprocess to a duplex stream.100+ */101+ duplex(duplexOptions?: DuplexOptions): Duplex;102+ };103 104 /**105 [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with additional methods and properties.106 */14 unmodified linesmodified:types/transform/normalize.d.ts+10 added-10 removed
4 unmodified lines5 // `options.std*: Generator`6 // @todo Use `string`, `Uint8Array` or `unknown` for both the argument and the return type, based on whether `encoding: 'buffer'` and `objectMode: true` are used.7 // See https://github.com/sindresorhus/execa/issues/6948 export type GeneratorTransform<IsSync extends boolean> = (chunk: unknown) =>9-| Unless<IsSync, AsyncGenerator<unknown, void, void>>10-| Generator<unknown, void, void>;9+ | Unless<IsSync, AsyncGenerator<unknown, void, void>>10+ | Generator<unknown, void, void>;11 type GeneratorFinal<IsSync extends boolean> = () =>12-| Unless<IsSync, AsyncGenerator<unknown, void, void>>13-| Generator<unknown, void, void>;12+ | Unless<IsSync, AsyncGenerator<unknown, void, void>>13+ | Generator<unknown, void, void>;14 15 export type TransformCommon = {16 /**17 If `true`, allow `transformOptions.transform` and `transformOptions.final` to return any type, not just `string` or `Uint8Array`.5 unmodified lines23 A transform or an array of transforms can be passed to the `stdin`, `stdout`, `stderr` or `stdio` option.24 25 A transform is either a generator function or a plain object with the following members.26 */27-export type GeneratorTransformFull<IsSync extends boolean> = {27+export type GeneratorTransformFull<IsSync extends boolean> = TransformCommon & {28 /**29 Map or filter the input or output of the subprocess.30 */31 readonly transform: GeneratorTransform<IsSync>;11 unmodified lines43 /**44 If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.45 */46 readonly preserveNewlines?: boolean;47-} & TransformCommon;47+};48 49 // `options.std*: Duplex`50-export type DuplexTransform = {50+export type DuplexTransform = TransformCommon & {51 readonly transform: Duplex;52-} & TransformCommon;52+};53 54 // `options.std*: TransformStream`55-export type WebTransform = {55+export type WebTransform = TransformCommon & {56 readonly transform: TransformStream;57-} & TransformCommon;57+};58 59 export {};modified:types/convert.d.ts+4 added-4 removed
48 unmodified lines49 export type SubprocessAsyncIterable<50 BinaryOption extends boolean | undefined,51 EncodingOption extends Options['encoding'],52 > = AsyncIterableIterator<53-EncodingOption extends BinaryEncodingOption54- ? Uint8Array55- : BinaryOption extends true53+ EncodingOption extends BinaryEncodingOption54 ? Uint8Array55+ : BinaryOption extends true56+ ? Uint8Array57- : string57+ : string58 >;59 60 export {};modified:types/ipc.d.ts+3 added-3 removed
134 unmodified lines135 };136 137 // Whether IPC is enabled, based on the `ipc`, `ipcInput` and `gracefulCancel` options138 export type HasIpc<OptionsType extends Options> = HasIpcOption<139-OptionsType['ipc'],140-'ipcInput' extends keyof OptionsType ? OptionsType['ipcInput'] : undefined,141-'gracefulCancel' extends keyof OptionsType ? OptionsType['gracefulCancel'] : undefined139+ OptionsType['ipc'],140+ 'ipcInput' extends keyof OptionsType ? OptionsType['ipcInput'] : undefined,141+ 'gracefulCancel' extends keyof OptionsType ? OptionsType['gracefulCancel'] : undefined142 >;143 144 type HasIpcOption<145 IpcOption extends Options['ipc'],13 unmodified linesmodified:types/verbose.d.ts+4 added-4 removed
1 unmodified line2 import type {Options, SyncOptions} from './arguments/options.js';3 import type {Result, SyncResult} from './return/result.js';4 5 export type VerboseOption = FdGenericOption<6-| 'none'7-| 'short'8-| 'full'9-| VerboseFunction6+ | 'none'7+ | 'short'8+ | 'full'9+ | VerboseFunction10 >;11 12 type VerboseFunction = (verboseLine: string, verboseObject: MinimalVerboseObject) => string | void;13 87 unmodified linesmodified:.gitignore+1 added
1 node_modules2 yarn.lock3 .nyc_output4 coverage5+lycheemodified:package.json+42 added-16 removed
15 unmodified lines16 "default": "./index.js"17 },18 "sideEffects": false,19 "engines": {20- "node": "^18.19.0 || >=20.5.0"20+ "node": ">=22"21 },22 "scripts": {23 "test": "npm run lint && npm run unit && npm run type",24 "lint": "xo",25 "unit": "c8 --merge-async ava",26- "type": "tsd && tsc && npx --yes tsd@0.29.0 && npx --yes --package typescript@5.1 tsc"26+ "type": "tsd && tsc"27 },28 "files": [29 "index.js",30 "index.d.ts",22 unmodified lines53 "dependencies": {54 "@sindresorhus/merge-streams": "^4.0.0",55 "cross-spawn": "^7.0.6",56 "figures": "^6.1.0",57- "get-stream": "^9.0.0",57+ "get-stream": "^9.0.1",58 "human-signals": "^8.0.1",59 "is-plain-obj": "^4.1.0",60 "is-stream": "^4.0.1",61 "npm-run-path": "^6.0.0",62- "pretty-ms": "^9.2.0",62+ "pretty-ms": "^9.3.0",63 "signal-exit": "^4.1.0",64 "strip-final-newline": "^4.0.0",65- "yoctocolors": "^2.1.1"65+ "yoctocolors": "^2.1.2"66 },67 "devDependencies": {68- "@types/node": "^22.15.21",69- "ava": "^6.3.0",70- "c8": "^10.1.3",71- "get-node": "^15.0.3",72- "is-in-ci": "^1.0.0",68+ "@types/node": "^26.1.0",69+ "ava": "^8.0.1",70+ "c8": "^11.0.0",71+ "get-node": "^15.0.4",72+ "is-in-ci": "^2.0.0",73 "is-running": "^2.1.0",74 "log-process-errors": "^12.0.1",75 "path-exists": "^5.0.0",76 "path-key": "^4.0.0",77- "tempfile": "^5.0.0",78- "tsd": "^0.32.0",79- "typescript": "^5.8.3",80- "which": "^5.0.0",81- "xo": "^0.60.0"77+ "tempfile": "^6.0.1",78+ "tsd": "^0.33.0",79+ "typescript": "^6.0.3",80+ "which": "^7.0.0",81+ "xo": "^3.0.2"82 },83 "c8": {84 "reporter": [85 "text",12 unmodified lines98 },99 "xo": {100 "rules": {101 "unicorn/no-empty-file": "off",102+ "unicorn/prefer-string-raw": "off",103+ "ava/test-title": "off",104+ "@typescript-eslint/no-empty-object-type": "off",105+ "unicorn/no-useless-template-literals": "off",106+ "require-unicode-regexp": "off",107+ "ava/no-nested-assertions": "off",108+ "@stylistic/max-len": "off",109+ "@typescript-eslint/no-unsafe-call": "off",110+ "@typescript-eslint/no-unsafe-member-access": "off",111+ "@typescript-eslint/no-unsafe-assignment": "off",112+ "@typescript-eslint/await-thenable": "off",113+ "@typescript-eslint/no-unnecessary-type-assertion": "off",114+ "@typescript-eslint/no-restricted-types": "off",115+ "no-shadow": "off",116+ "unicorn/no-computed-property-existence-check": "off",117+ "unicorn/max-nested-calls": "off",118+ "markdown/fenced-code-language": "off",119+ "unicorn/no-array-sort": "off",120+ "unicorn/prefer-minimal-ternary": "off",121+ "unicorn/no-array-reverse": "off",122+ "unicorn/no-array-from-fill": "off",123+ "unicorn/prefer-number-is-safe-integer": "off",124+ "unicorn/require-array-sort-compare": "off",102- "@typescript-eslint/ban-types": "off"125+ "@typescript-eslint/ban-types": "off",126+ "regexp/strict": "off",127+ "unicorn/require-module-specifiers": "off",128+ "jsdoc/require-asterisk-prefix": "off"129 }130 }131 }modified:tsconfig.json+2 added-1 removed
1 unmodified line2 "compilerOptions": {3 "module": "nodenext",4 "moduleResolution": "nodenext",5 "target": "ES2022",6- "strict": true6+ "strict": true,7+ "types": ["node"]8 },9 "files": [10 "index.d.ts"11 ]1 unmodified line