Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors, child_process: use more internal/errors codes #14998

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[squash] simply & rm one-off expectedError vars
maclover7 committed Nov 28, 2017
commit bd60e810c802e8e7b4959c227e5befc5fec9f22c
7 changes: 3 additions & 4 deletions test/parallel/test-child-process-fork-stdio-string-variant.js
Original file line number Diff line number Diff line change
@@ -13,10 +13,9 @@ const childScript = fixtures.path('child-process-spawn-node');
const malFormedOpts = { stdio: '33' };
const payload = { hello: 'world' };

const expectedError =
common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', type: TypeError });

assert.throws(() => fork(childScript, malFormedOpts), expectedError);
common.expectsError(
() => fork(childScript, malFormedOpts),
{ code: 'ERR_INVALID_OPT_VALUE', type: TypeError });

function test(stringVariant) {
const child = fork(childScript, { stdio: stringVariant });
9 changes: 3 additions & 6 deletions test/parallel/test-child-process-fork-stdio.js
Original file line number Diff line number Diff line change
@@ -19,12 +19,9 @@ if (process.argv[2] === 'child') {
process.send(data);
});
} else {
const expectedError =
common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', type: TypeError });

assert.throws(() => {
cp.fork(__filename, { stdio: ['pipe', 'pipe', 'pipe', 'pipe'] });
}, expectedError);
common.expectsError(
() => cp.fork(__filename, { stdio: ['pipe', 'pipe', 'pipe', 'pipe'] }),
{ code: 'ERR_INVALID_OPT_VALUE', type: TypeError });

let ipc = '';
let stderr = '';
10 changes: 3 additions & 7 deletions test/parallel/test-child-process-spawnsync-input.js
Original file line number Diff line number Diff line change
@@ -76,13 +76,9 @@ let options = {
input: 1234
};

const expectedError =
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 1);

assert.throws(function() {
spawnSync('cat', [], options);
}, expectedError);

common.expectsError(
() => spawnSync('cat', [], options),
{ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 1);

options = {
input: 'hello world'