diff --git a/test/simple/test-crypto-domains.js b/test/simple/test-crypto-domains.js index 0562fe45b00a..5c383860d14a 100644 --- a/test/simple/test-crypto-domains.js +++ b/test/simple/test-crypto-domains.js @@ -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'); +});