Permalink
Browse files

test: merge test with unnecessary child process

Test didn't require child process creation. While this test has not been
unstable, child process creation is slower and can be flaky in ci, so
test directly for the segfault regression.

PR-URL: #25025
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
  • Loading branch information...
sam-github authored and MylesBorins committed Dec 13, 2018
1 parent ed3303b commit 30b61554f64478935894dad7016df4de8b4aa278
@@ -111,6 +111,17 @@ assert.throws(function() {
crypto.createHash('xyzzy');
}, /Digest method not supported/);

// Issue https://github.com/nodejs/node/issues/9819: throwing encoding used to
// segfault.
common.expectsError(
() => crypto.createHash('sha256').digest({
toString: () => { throw new Error('boom'); },
}),
{
type: Error,
message: 'boom'
});

// Default UTF-8 encoding
const hutf8 = crypto.createHash('sha512').update('УТФ-8 text').digest('hex');
assert.strictEqual(
@@ -21,6 +21,16 @@ common.expectsError(
message: 'The "hmac" argument must be of type string. Received type object'
});

// This used to segfault. See: https://github.com/nodejs/node/issues/9819
common.expectsError(
() => crypto.createHmac('sha256', 'key').digest({
toString: () => { throw new Error('boom'); },
}),
{
type: Error,
message: 'boom'
});

common.expectsError(
() => crypto.createHmac('sha1', null),
{

This file was deleted.

Oops, something went wrong.

0 comments on commit 30b6155

Please sign in to comment.