From 2315a2389860d309e1563cf484039c07e4aed2b5 Mon Sep 17 00:00:00 2001 From: MaleDong Date: Mon, 17 Sep 2018 13:50:09 +0800 Subject: [PATCH 1/2] test: Remove string literals for strictEquals/notStrictEquals Ref: https://github.com/nodejs/node/pull/22849. In short: Some unit tests are using string literals to simply tell you a conclusion what's right/wrong BUT not tell you what actually values are. So it's necessary to print them out in the console. --- test/fixtures/not-main-module.js | 5 ++--- test/parallel/test-async-wrap-trigger-id.js | 8 ++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/test/fixtures/not-main-module.js b/test/fixtures/not-main-module.js index f0bae3db15721d..247868101f981e 100644 --- a/test/fixtures/not-main-module.js +++ b/test/fixtures/not-main-module.js @@ -20,6 +20,5 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. const assert = require('assert'); -assert.notStrictEqual(module, require.main, 'require.main should not == module'); -assert.notStrictEqual(module, process.mainModule, - 'process.mainModule should not === module'); +assert.notStrictEqual(module, require.main); +assert.notStrictEqual(module, process.mainModule); diff --git a/test/parallel/test-async-wrap-trigger-id.js b/test/parallel/test-async-wrap-trigger-id.js index 271fe3b107e0dc..50259cdbcb4afb 100644 --- a/test/parallel/test-async-wrap-trigger-id.js +++ b/test/parallel/test-async-wrap-trigger-id.js @@ -13,16 +13,12 @@ process.nextTick(() => { triggerAsyncId1 = triggerAsyncId(); assert.notStrictEqual( triggerAsyncId0, - triggerAsyncId1, - 'Async resources having different causal ancestry ' + - 'should have different triggerAsyncIds'); + triggerAsyncId1); }); process.nextTick(() => { const triggerAsyncId2 = triggerAsyncId(); assert.strictEqual( triggerAsyncId1, - triggerAsyncId2, - 'Async resources having the same causal ancestry ' + - 'should have the same triggerAsyncId'); + triggerAsyncId2); }); }); From bc0ff7c7c732d9ddad3f5d265a1a578d3152e7e6 Mon Sep 17 00:00:00 2001 From: MaleDong Date: Thu, 20 Sep 2018 14:28:58 +0800 Subject: [PATCH 2/2] Fix to keep the valuable msg --- test/parallel/test-async-wrap-trigger-id.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/parallel/test-async-wrap-trigger-id.js b/test/parallel/test-async-wrap-trigger-id.js index 50259cdbcb4afb..e8b4682b7167f8 100644 --- a/test/parallel/test-async-wrap-trigger-id.js +++ b/test/parallel/test-async-wrap-trigger-id.js @@ -11,12 +11,16 @@ let triggerAsyncId1; process.nextTick(() => { process.nextTick(() => { triggerAsyncId1 = triggerAsyncId(); + // Async resources having different causal ancestry + // should have different triggerAsyncIds assert.notStrictEqual( triggerAsyncId0, triggerAsyncId1); }); process.nextTick(() => { const triggerAsyncId2 = triggerAsyncId(); + // Async resources having the same causal ancestry + // should have the same triggerAsyncId assert.strictEqual( triggerAsyncId1, triggerAsyncId2);