mirror of https://github.com/nodejs/node.git
test: crypto-domains avoid spurious failures
The order of the callbacks is non-deterministic, so don't expect the error messages to come back in the same order every time, instead just verify they are expected messages.pull/23395/head
parent
d601c76f4d
commit
2afa3d8a03
|
@ -26,7 +26,9 @@ var d = domain.create();
|
|||
var expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes']
|
||||
|
||||
d.on('error', function (e) {
|
||||
assert.equal(e.message, expect.shift());
|
||||
var idx = expect.indexOf(e.message);
|
||||
assert.notEqual(idx, -1, 'we should have error: ' + e.message);
|
||||
expect.splice(idx, 1);
|
||||
});
|
||||
|
||||
d.run(function () {
|
||||
|
@ -42,3 +44,7 @@ d.run(function () {
|
|||
throw new Error('pseudoRandomBytes');
|
||||
});
|
||||
});
|
||||
|
||||
process.on('exit', function () {
|
||||
assert.strictEqual(expect.length, 0, 'we should have seen all error messages');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue