Skip to content

Commit bdbd975

Browse files
authoredDec 3, 2020
Remove faulty emulated ENOENT error on Windows (#447)
1 parent 2706b3f commit bdbd975

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed
 

‎index.js

-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ const execa = (file, args, options) => {
147147

148148
const handlePromiseOnce = onetime(handlePromise);
149149

150-
crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);
151-
152150
handleInput(spawned, parsed.options.input);
153151

154152
spawned.all = makeAllStream(spawned, parsed.options);

‎test/error.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ test('error.shortMessage does not contain stdout/stderr', async t => {
7373
});
7474

7575
test('Original error.message is kept', async t => {
76-
const {originalMessage} = await t.throwsAsync(execa('wrong command'));
77-
t.is(originalMessage, 'spawn wrong command ENOENT');
76+
const {originalMessage} = await t.throwsAsync(execa('noop', {cwd: 1}));
77+
t.true(originalMessage.startsWith('The "options.cwd" property must be of type string. Received type number'));
7878
});
7979

8080
test('failed is false on success', async t => {
@@ -205,6 +205,6 @@ test('error.code is undefined on success', async t => {
205205
});
206206

207207
test('error.code is defined on failure if applicable', async t => {
208-
const {code} = await t.throwsAsync(execa('invalid'));
209-
t.is(code, 'ENOENT');
208+
const {code} = await t.throwsAsync(execa('noop', {cwd: 1}));
209+
t.is(code, 'ERR_INVALID_ARG_TYPE');
210210
});

0 commit comments

Comments
 (0)
Please sign in to comment.