Meta tweaks
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sindre Sorhus · committed by Sindre Sorhus · parent c6e791a · Browse files · 10 files·+28 added−19 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+28 added−19 removed
- tests:+15 added−12 removed
- other:+13 added−7 removed
Provenance
- Commit
5bac052- Tree
38490f5- Author
Sindre Sorhus <sindresorhus@gmail.com>- Committer
Sindre Sorhus <sindresorhus@gmail.com>- Parent
c6e791a
10 files changed+28 added−19 removed
modified:test/helpers/override-promise.js+1 added-1 removed
1234456783 unmodified lines// 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'); }};
3 unmodified linesmodified:test/command.js+1 added-1 removed
2 unmodified lines34567789101178 unmodified lines2 unmodified linesimport {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)); t.is(failCommand, `fail.js${expected}`);78 unmodified linesmodified:test/error.js+1 added-1 removed
6 unmodified lines7 import {execa, execaSync} from '../index.js';8 9 const pExec = promisify(childProcess.exec);10 11-process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH;11+process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH;12 13 const TIMEOUT_REGEXP = /timed out after/;14 15 const getExitRegExp = exitMessage => new RegExp(`failed with exit code ${exitMessage}`);203 unmodified linesmodified:test/kill.js+1 added-1 removed
4 unmodified lines5 import {pEvent} from 'p-event';6 import isRunning from 'is-running';7 import {execa, execaSync} from '../index.js';8 9-process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH;9+process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH;10 11 const TIMEOUT_REGEXP = /timed out after/;12 13 test('kill("SIGKILL") should terminate cleanly', async t => {298 unmodified linesmodified:test/node.js+1 added-1 removed
3 unmodified lines4 import test from 'ava';5 import {pEvent} from 'p-event';6 import {execaNode} from '../index.js';7 8-process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH;8+process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH;9 10 async function inspectMacro(t, input) {11 const originalArgv = process.execArgv;12 process.execArgv = [input, '-e'];92 unmodified linesmodified:test/override-promise.js+1 added-1 removed
8 unmodified lines9101112131314151617188 unmodified linesimport {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']); t.is(stdout, 'foo');});modified:test/promise.js+1 added-1 removed
2 unmodified lines34567789101136 unmodified lines2 unmodified linesimport {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')); t.false(descriptors.then.enumerable);36 unmodified linesmodified:test/stream.js+3 added-2 removed
7 unmodified lines8 import getStream from 'get-stream';9 import tempfile from 'tempfile';10 import {execa, execaSync} from '../index.js';11 12-process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH;12+process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH;13 14 test('buffer', async t => {15 const {stdout} = await execa('noop.js', ['foo'], {encoding: null});16 t.true(Buffer.isBuffer(stdout));56 unmodified lines73 74 test('you can write to child.stdin', async t => {75 const subprocess = execa('stdin.js');76 subprocess.stdin.end('unicorns');77+ const {stdout} = await subprocess;77- t.is((await subprocess).stdout, 'unicorns');78+ t.is(stdout, 'unicorns');79 });80 81 test('input option can be a String - sync', t => {82 const {stdout} = execaSync('stdin.js', {input: 'foobar'});119 unmodified linesmodified:test/test.js+5 added-3 removed
5 unmodified lines6 import getNode from 'get-node';7 import semver from 'semver';8 import {execa, execaSync} from '../index.js';9 10-process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH;10+process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH;11 process.env.FOO = 'foo';12 13 const ENOENT_REGEXP = process.platform === 'win32' ? /failed with exit code 1/ : /spawn.* ENOENT/;14 132 unmodified lines147 });148 149 test('do not try to consume streams twice', async t => {150 const subprocess = execa('noop.js', ['foo']);151- t.is((await subprocess).stdout, 'foo');152- t.is((await subprocess).stdout, 'foo');151+ const {stdout} = await subprocess;152+ const {stdout: stdout2} = await subprocess;153+ t.is(stdout, 'foo');154+ t.is(stdout2, 'foo');155 });156 157 test('use relative path with \'..\' chars', async t => {158 const pathViaParentDir = path.join('..', path.basename(fileURLToPath(new URL('..', import.meta.url))), 'test', 'fixtures', 'noop.js');94 unmodified linesmodified:package.json+13 added-7 removed
44 unmodified lines45 "get-stream": "^6.0.1",46 "human-signals": "^3.0.1",47 "is-stream": "^3.0.0",48 "merge-stream": "^2.0.0",49- "npm-run-path": "^5.0.1",49+ "npm-run-path": "^5.1.0",50 "onetime": "^6.0.0",51- "signal-exit": "^3.0.5",51+ "signal-exit": "^3.0.7",52 "strip-final-newline": "^3.0.0"53 },54 "devDependencies": {55- "@types/node": "^16.11.7",56- "ava": "^3.15.0",57- "c8": "^7.10.0",55+ "@types/node": "^17.0.17",56+ "ava": "^4.0.1",57+ "c8": "^7.11.0",58 "get-node": "^12.0.0",59 "is-running": "^2.1.0",60 "p-event": "^5.0.1",61 "semver": "^7.3.5",62 "tempfile": "^4.0.0",63- "tsd": "^0.18.0",64- "xo": "^0.46.4"63+ "tsd": "^0.19.1",64+ "xo": "^0.48.0"65 },66 "c8": {67 "reporter": [68 "text",3 unmodified lines72 "**/fixtures/**",73 "**/test.js",74 "**/test/**"75 ]76+ },77+ "xo": {78+ "rules": {79+ "unicorn/no-empty-file": "off",80+ "@typescript-eslint/ban-types": "off"81+ }82 }83 }