Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 2afa3d8

Browse files
committed
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.
1 parent d601c76 commit 2afa3d8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/simple/test-crypto-domains.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ var d = domain.create();
2626
var expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes']
2727

2828
d.on('error', function (e) {
29-
assert.equal(e.message, expect.shift());
29+
var idx = expect.indexOf(e.message);
30+
assert.notEqual(idx, -1, 'we should have error: ' + e.message);
31+
expect.splice(idx, 1);
3032
});
3133

3234
d.run(function () {
@@ -42,3 +44,7 @@ d.run(function () {
4244
throw new Error('pseudoRandomBytes');
4345
});
4446
});
47+
48+
process.on('exit', function () {
49+
assert.strictEqual(expect.length, 0, 'we should have seen all error messages');
50+
});

0 commit comments

Comments
 (0)