From 8311561ed5309db2cf96bf24e41afe9d58b32b24 Mon Sep 17 00:00:00 2001 From: Neil Vass Date: Wed, 8 Nov 2017 12:48:01 +0000 Subject: [PATCH] test: improve assertion messages Print content of domain stack if it doesn't match expected values PR-URL: https://github.com/nodejs/node/pull/16885 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil --- test/parallel/test-domain-safe-exit.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-domain-safe-exit.js b/test/parallel/test-domain-safe-exit.js index f6c46d3d757cda..3a111107869665 100644 --- a/test/parallel/test-domain-safe-exit.js +++ b/test/parallel/test-domain-safe-exit.js @@ -20,18 +20,21 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; +require('../common'); // Make sure the domain stack doesn't get clobbered by un-matched .exit() -require('../common'); const assert = require('assert'); const domain = require('domain'); +const util = require('util'); const a = domain.create(); const b = domain.create(); a.enter(); // push b.enter(); // push -assert.deepStrictEqual(domain._stack, [a, b], 'b not pushed'); +assert.deepStrictEqual(domain._stack, [a, b], 'Unexpected stack shape ' + + `(domain._stack = ${util.inspect(domain._stack)})`); domain.create().exit(); // no-op -assert.deepStrictEqual(domain._stack, [a, b], 'stack mangled!'); +assert.deepStrictEqual(domain._stack, [a, b], 'Unexpected stack shape ' + + `(domain._stack = ${util.inspect(domain._stack)})`);