Skip to content

Commit 8311561

Browse files
Neil Vassevanlucas
Neil Vass
authored andcommitted
test: improve assertion messages
Print content of domain stack if it doesn't match expected values PR-URL: #16885 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
1 parent 38ac50a commit 8311561

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/parallel/test-domain-safe-exit.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23+
require('../common');
2324
// Make sure the domain stack doesn't get clobbered by un-matched .exit()
2425

25-
require('../common');
2626
const assert = require('assert');
2727
const domain = require('domain');
28+
const util = require('util');
2829

2930
const a = domain.create();
3031
const b = domain.create();
3132

3233
a.enter(); // push
3334
b.enter(); // push
34-
assert.deepStrictEqual(domain._stack, [a, b], 'b not pushed');
35+
assert.deepStrictEqual(domain._stack, [a, b], 'Unexpected stack shape ' +
36+
`(domain._stack = ${util.inspect(domain._stack)})`);
3537

3638
domain.create().exit(); // no-op
37-
assert.deepStrictEqual(domain._stack, [a, b], 'stack mangled!');
39+
assert.deepStrictEqual(domain._stack, [a, b], 'Unexpected stack shape ' +
40+
`(domain._stack = ${util.inspect(domain._stack)})`);

0 commit comments

Comments
 (0)