diff --git a/package.json b/package.json index 1871388793..b61901fc15 100644 --- a/package.json +++ b/package.json @@ -46,22 +46,22 @@ "human-signals": "^3.0.1", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", - "npm-run-path": "^5.0.1", + "npm-run-path": "^5.1.0", "onetime": "^6.0.0", - "signal-exit": "^3.0.5", + "signal-exit": "^3.0.7", "strip-final-newline": "^3.0.0" }, "devDependencies": { - "@types/node": "^16.11.7", - "ava": "^3.15.0", - "c8": "^7.10.0", + "@types/node": "^17.0.17", + "ava": "^4.0.1", + "c8": "^7.11.0", "get-node": "^12.0.0", "is-running": "^2.1.0", "p-event": "^5.0.1", "semver": "^7.3.5", "tempfile": "^4.0.0", - "tsd": "^0.18.0", - "xo": "^0.46.4" + "tsd": "^0.19.1", + "xo": "^0.48.0" }, "c8": { "reporter": [ @@ -73,5 +73,11 @@ "**/test.js", "**/test/**" ] + }, + "xo": { + "rules": { + "unicorn/no-empty-file": "off", + "@typescript-eslint/ban-types": "off" + } } } diff --git a/test/command.js b/test/command.js index 0db7ab9c49..b020d7a2ae 100644 --- a/test/command.js +++ b/test/command.js @@ -4,7 +4,7 @@ import {fileURLToPath} from 'node:url'; import test from 'ava'; import {execa, execaSync, execaCommand, execaCommandSync} from '../index.js'; -process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH; +process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH; const command = async (t, expected, ...args) => { const {command: failCommand} = await t.throwsAsync(execa('fail.js', args)); diff --git a/test/error.js b/test/error.js index a9c7746f86..ae7f34b71f 100644 --- a/test/error.js +++ b/test/error.js @@ -8,7 +8,7 @@ import {execa, execaSync} from '../index.js'; const pExec = promisify(childProcess.exec); -process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH; +process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH; const TIMEOUT_REGEXP = /timed out after/; diff --git a/test/helpers/override-promise.js b/test/helpers/override-promise.js index f69bb8ae5d..e601a88549 100644 --- a/test/helpers/override-promise.js +++ b/test/helpers/override-promise.js @@ -1,7 +1,7 @@ // Can't use `test.before`, because `ava` needs `Promise`. const nativePromise = Promise; global.Promise = class BrokenPromise { - then() { + then() { // eslint-disable-line unicorn/no-thenable throw new Error('error'); } }; diff --git a/test/kill.js b/test/kill.js index c26c58d494..c0a02bb045 100644 --- a/test/kill.js +++ b/test/kill.js @@ -6,7 +6,7 @@ import {pEvent} from 'p-event'; import isRunning from 'is-running'; import {execa, execaSync} from '../index.js'; -process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH; +process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH; const TIMEOUT_REGEXP = /timed out after/; diff --git a/test/node.js b/test/node.js index eeead60823..31a132a792 100644 --- a/test/node.js +++ b/test/node.js @@ -5,7 +5,7 @@ import test from 'ava'; import {pEvent} from 'p-event'; import {execaNode} from '../index.js'; -process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH; +process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH; async function inspectMacro(t, input) { const originalArgv = process.execArgv; diff --git a/test/override-promise.js b/test/override-promise.js index 4c200e37f4..986316e3a4 100644 --- a/test/override-promise.js +++ b/test/override-promise.js @@ -10,7 +10,7 @@ import {execa} from '../index.js'; restorePromise(); -process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH; +process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH; test('should work with third-party Promise', async t => { const {stdout} = await execa('noop.js', ['foo']); diff --git a/test/promise.js b/test/promise.js index 9f52892e7c..c32e91346d 100644 --- a/test/promise.js +++ b/test/promise.js @@ -4,7 +4,7 @@ import {fileURLToPath} from 'node:url'; import test from 'ava'; import {execa} from '../index.js'; -process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH; +process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH; test('promise methods are not enumerable', t => { const descriptors = Object.getOwnPropertyDescriptors(execa('noop.js')); diff --git a/test/stream.js b/test/stream.js index 7788ae99dc..b3341aafdc 100644 --- a/test/stream.js +++ b/test/stream.js @@ -9,7 +9,7 @@ import getStream from 'get-stream'; import tempfile from 'tempfile'; import {execa, execaSync} from '../index.js'; -process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH; +process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH; test('buffer', async t => { const {stdout} = await execa('noop.js', ['foo'], {encoding: null}); @@ -74,7 +74,8 @@ test('input can be a Stream', async t => { test('you can write to child.stdin', async t => { const subprocess = execa('stdin.js'); subprocess.stdin.end('unicorns'); - t.is((await subprocess).stdout, 'unicorns'); + const {stdout} = await subprocess; + t.is(stdout, 'unicorns'); }); test('input option can be a String - sync', t => { diff --git a/test/test.js b/test/test.js index d24607631d..e49e4e846b 100644 --- a/test/test.js +++ b/test/test.js @@ -7,7 +7,7 @@ import getNode from 'get-node'; import semver from 'semver'; import {execa, execaSync} from '../index.js'; -process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH; +process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH; process.env.FOO = 'foo'; const ENOENT_REGEXP = process.platform === 'win32' ? /failed with exit code 1/ : /spawn.* ENOENT/; @@ -148,8 +148,10 @@ test('child_process.spawnSync() errors are propagated with a correct shape', t = test('do not try to consume streams twice', async t => { const subprocess = execa('noop.js', ['foo']); - t.is((await subprocess).stdout, 'foo'); - t.is((await subprocess).stdout, 'foo'); + const {stdout} = await subprocess; + const {stdout: stdout2} = await subprocess; + t.is(stdout, 'foo'); + t.is(stdout2, 'foo'); }); test('use relative path with \'..\' chars', async t => {