Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 13, 2022
1 parent c6e791a commit 5bac052
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 19 deletions.
20 changes: 13 additions & 7 deletions package.json
Expand Up @@ -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": [
Expand All @@ -73,5 +73,11 @@
"**/test.js",
"**/test/**"
]
},
"xo": {
"rules": {
"unicorn/no-empty-file": "off",
"@typescript-eslint/ban-types": "off"
}
}
}
2 changes: 1 addition & 1 deletion test/command.js
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion test/error.js
Expand Up @@ -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/;

Expand Down
2 changes: 1 addition & 1 deletion 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');
}
};
Expand Down
2 changes: 1 addition & 1 deletion test/kill.js
Expand Up @@ -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/;

Expand Down
2 changes: 1 addition & 1 deletion test/node.js
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/override-promise.js
Expand Up @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion test/promise.js
Expand Up @@ -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'));
Expand Down
5 changes: 3 additions & 2 deletions test/stream.js
Expand Up @@ -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});
Expand Down Expand Up @@ -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 => {
Expand Down
8 changes: 5 additions & 3 deletions test/test.js
Expand Up @@ -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/;
Expand Down Expand Up @@ -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 => {
Expand Down

0 comments on commit 5bac052

Please sign in to comment.