Skip to content

Commit 2043ce3

Browse files
Neil VassMylesBorins
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 <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent fce7902 commit 2043ce3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
+6-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
'use strict';
2+
require('../common');
23
// Make sure the domain stack doesn't get clobbered by un-matched .exit()
34

4-
require('../common');
55
const assert = require('assert');
66
const domain = require('domain');
7+
const util = require('util');
78

89
const a = domain.create();
910
const b = domain.create();
1011

1112
a.enter(); // push
1213
b.enter(); // push
13-
assert.deepStrictEqual(domain._stack, [a, b], 'b not pushed');
14+
assert.deepStrictEqual(domain._stack, [a, b], 'Unexpected stack shape ' +
15+
`(domain._stack = ${util.inspect(domain._stack)})`);
1416

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

0 commit comments

Comments
 (0)