From 08306d2d9f94edaedffe3a01432e6d3f89d8898c Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Tue, 9 Nov 2021 07:22:12 -0300 Subject: [PATCH] chore: add node16 support (#382) * chore: upgrade tap * chore: add node v16+ to CI * chore: add taprc options * fix: adjust nyc to not spawn process * chore: add --no-warnings options for process.binding * tests: adjust test to consider TickObject as part of on v15+ * update: add node: prefix to consider internal in frames * fix: lint --- .github/workflows/ci.yml | 2 +- .nycrc.yaml | 3 + .taprc | 7 ++ analysis/stack-trace/frames.js | 2 +- collect/stack-trace.js | 3 +- package.json | 10 +- test/analysis-aggregate-combine.test.js | 12 +-- test/analysis-aggregate-mark-http.test.js | 34 +++--- test/analysis-aggregate-mark-module.test.js | 12 +-- test/analysis-aggregate-mark-party.test.js | 14 +-- test/analysis-aggregate.test.js | 76 ++++++------- test/analysis-barrier-make-external.test.js | 22 ++-- ...er-make-synchronous-barrier-parent.test.js | 10 +- .../analysis-barrier-make-synchronous.test.js | 16 +-- ...nalysis-barrier-name-barrier-nodes.test.js | 48 ++++----- test/analysis-barrier-wrap.test.js | 4 +- test/analysis-barrier.test.js | 54 +++++----- test/analysis-cluster-combine.test.js | 10 +- test/analysis-cluster.test.js | 32 +++--- test/analysis-raw-event-join.test.js | 30 +++--- test/analysis-raw-event.test.js | 4 +- test/analysis-source-combine.test.js | 12 +-- test/analysis-source-filter.test.js | 6 +- test/analysis-source-http-requests.test.js | 4 +- test/analysis-source-indentify.test.js | 12 +-- test/analysis-source-restructure-net.test.js | 22 ++-- test/analysis-source.test.js | 44 ++++---- test/analysis-stack-trace-frames.test.js | 66 ++++++------ test/analysis-stack-trace.test.js | 8 +- test/analysis-system-info.test.js | 8 +- test/analysis-trace-event.test.js | 6 +- test/analysis.test.js | 8 +- test/cmd-collect-analysing.test.js | 4 +- test/cmd-collect-detect-port.test.js | 2 +- test/cmd-collect-exit.test.js | 6 +- test/cmd-collect-node-options-env.test.js | 4 +- test/cmd-collect.test.js | 22 ++-- test/cmd-dest.test.js | 4 +- test/cmd-no-cluster.test.js | 4 +- test/cmd-visualize.test.js | 4 +- test/collect-get-logging-paths.test.js | 4 +- test/collect-stack-trace.test.js | 10 +- test/format-stack-trace.test.js | 24 ++--- test/format-trace-events.test.js | 4 +- test/integration-servers.test.js | 6 +- test/integration-timeout.test.js | 18 ++-- test/visualizer-data-callback-event.test.js | 56 +++++----- test/visualizer-data-dataset.test.js | 46 ++++---- test/visualizer-data-node.test.js | 14 +-- test/visualizer-layout-layer.test.js | 34 +++--- .../visualizer-layout-node-allocation.test.js | 16 +-- test/visualizer-layout-positioning.test.js | 62 +++++------ test/visualizer-layout-scale.test.js | 6 +- test/visualizer-layout-stems.test.js | 20 ++-- test/visualizer-layout.test.js | 70 ++++++------ test/visualizer-line-coordinates.test.js | 4 +- .../verify-garbage-collection.js | 2 +- test/visualizer-validation.test.js | 102 +++++++++--------- 58 files changed, 580 insertions(+), 569 deletions(-) create mode 100644 .nycrc.yaml create mode 100644 .taprc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 224c69a0..7b7fe1a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node-version: [12.13.0, 12.x, 14.x, 15.x] + node-version: [12.13.0, 12.x, 14.x, 15.x, 16.x, 17.x] runs-on: ${{matrix.os}} steps: diff --git a/.nycrc.yaml b/.nycrc.yaml new file mode 100644 index 00000000..4ca61a14 --- /dev/null +++ b/.nycrc.yaml @@ -0,0 +1,3 @@ +# # This option avoid an wrap by nyc that affects our expected async events. +# # See: https://github.com/clinicjs/node-clinic-bubbleprof/pull/382 +use-spawn-wrap: true diff --git a/.taprc b/.taprc new file mode 100644 index 00000000..f85ab618 --- /dev/null +++ b/.taprc @@ -0,0 +1,7 @@ +timeout: 50 +jobs: 1 +statements: 95 +branches: 90 +functions: 95 +lines: 98 +test-env: NODE_OPTIONS=--no-warnings diff --git a/analysis/stack-trace/frames.js b/analysis/stack-trace/frames.js index 63078528..5556e69e 100644 --- a/analysis/stack-trace/frames.js +++ b/analysis/stack-trace/frames.js @@ -38,7 +38,7 @@ class Frame { // evals and natives are not in nodecore if (this.isEval || this.isNative) return false - if (fileName.startsWith(`internal${systemInfo.pathSeparator}`)) { + if (fileName.startsWith('node:') || fileName.startsWith(`internal${systemInfo.pathSeparator}`)) { return true } diff --git a/collect/stack-trace.js b/collect/stack-trace.js index c6e30522..f5992ef9 100644 --- a/collect/stack-trace.js +++ b/collect/stack-trace.js @@ -70,7 +70,8 @@ function stackTrace (skip) { // Don't include async_hooks frames return frames.slice(skip).filter(function (frame) { return (frame.fileName !== 'async_hooks.js' && - frame.fileName !== 'internal/async_hooks.js') + frame.fileName !== 'internal/async_hooks.js' && + frame.fileName !== 'node:internal/async_hooks') }) } module.exports = stackTrace diff --git a/package.json b/package.json index 6ab803c0..f00bbee7 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,11 @@ "node": ">=12.13.0" }, "scripts": { - "test": "standard | snazzy && tap -j1 --no-cov --timeout=50 test/*.test.js", - "test:file": "standard | snazzy && tap -j1 --no-cov --timeout=50", + "test": "standard | snazzy && tap --no-cov test/*.test.js", + "test:file": "standard | snazzy && tap --no-cov", "ci-lint": "standard | snazzy", - "ci-test": "tap -j1 --timeout=50 test/*.test.js", - "ci-cov": "tap -j1 --statements=95 --branches=90 --functions=95 --lines=98 --timeout=60 test/*.test.js", + "ci-test": "tap test/*.test.js", + "ci-cov": "tap test/*.test.js", "lint": "standard --fix | snazzy", "visualize-watch": "node debug/visualize-watch.js", "visualize-all": "node debug/visualize-all.js" @@ -27,7 +27,7 @@ "snazzy": "^9.0.0", "standard": "^16.0.3", "startpoint": "^0.3.2", - "tap": "^14.11.0" + "tap": "^15.0.10" }, "keywords": [], "license": "MIT", diff --git a/test/analysis-aggregate-combine.test.js b/test/analysis-aggregate-combine.test.js index 9294c70d..26a179a7 100644 --- a/test/analysis-aggregate-combine.test.js +++ b/test/analysis-aggregate-combine.test.js @@ -67,10 +67,10 @@ test('Aggregate Node - combine', function (t) { startpoint(sourceNodes, { objectMode: true }) .pipe(new CombineAsAggregateNodes()) .pipe(endpoint({ objectMode: true }, function (err, aggregateNodes) { - if (err) return t.ifError(err) + if (err) return t.error(err) // root - t.strictDeepEqual(aggregateNodes[0].toJSON(), { + t.strictSame(aggregateNodes[0].toJSON(), { aggregateId: 1, parentAggregateId: 0, children: [2], @@ -82,7 +82,7 @@ test('Aggregate Node - combine', function (t) { }) // server - t.strictDeepEqual(aggregateNodes[1].toJSON(), { + t.strictSame(aggregateNodes[1].toJSON(), { aggregateId: 2, parentAggregateId: 1, children: [3], @@ -94,7 +94,7 @@ test('Aggregate Node - combine', function (t) { }) // socket - t.strictDeepEqual(aggregateNodes[2].toJSON(), { + t.strictSame(aggregateNodes[2].toJSON(), { aggregateId: 3, parentAggregateId: 2, children: [4, 5], @@ -106,7 +106,7 @@ test('Aggregate Node - combine', function (t) { }) // log - t.strictDeepEqual(aggregateNodes[3].toJSON(), { + t.strictSame(aggregateNodes[3].toJSON(), { aggregateId: 4, parentAggregateId: 3, children: [], @@ -118,7 +118,7 @@ test('Aggregate Node - combine', function (t) { }) // end - t.strictDeepEqual(aggregateNodes[4].toJSON(), { + t.strictSame(aggregateNodes[4].toJSON(), { aggregateId: 5, parentAggregateId: 3, children: [], diff --git a/test/analysis-aggregate-mark-http.test.js b/test/analysis-aggregate-mark-http.test.js index 60ef6e09..cb8bf47e 100644 --- a/test/analysis-aggregate-mark-http.test.js +++ b/test/analysis-aggregate-mark-http.test.js @@ -87,27 +87,27 @@ function checkTreeStructure (t, sourceNodes) { aggregateNodeUnknownParent ] = sourceNodes - t.strictEqual(aggregateNodeRoot.aggregateId, 1) - t.strictEqual(aggregateNodeServer.aggregateId, 2) - t.strictEqual(aggregateNodeSocket.aggregateId, 3) - t.strictEqual(aggregateNodeHttpParser.aggregateId, 4) - t.strictEqual(aggregateNodeReady.aggregateId, 5) - t.strictEqual(aggregateNodeWriteWrap.aggregateId, 6) - t.strictEqual(aggregateNodeUnknownParent.aggregateId, 11) - - t.strictDeepEqual(aggregateNodeRoot.mark.toJSON(), + t.equal(aggregateNodeRoot.aggregateId, 1) + t.equal(aggregateNodeServer.aggregateId, 2) + t.equal(aggregateNodeSocket.aggregateId, 3) + t.equal(aggregateNodeHttpParser.aggregateId, 4) + t.equal(aggregateNodeReady.aggregateId, 5) + t.equal(aggregateNodeWriteWrap.aggregateId, 6) + t.equal(aggregateNodeUnknownParent.aggregateId, 11) + + t.strictSame(aggregateNodeRoot.mark.toJSON(), ['root', null, null]) - t.strictDeepEqual(aggregateNodeServer.mark.toJSON(), + t.strictSame(aggregateNodeServer.mark.toJSON(), ['nodecore', 'net', 'server']) - t.strictDeepEqual(aggregateNodeSocket.mark.toJSON(), + t.strictSame(aggregateNodeSocket.mark.toJSON(), ['nodecore', 'net', 'onconnection']) - t.strictDeepEqual(aggregateNodeHttpParser.mark.toJSON(), + t.strictSame(aggregateNodeHttpParser.mark.toJSON(), ['nodecore', 'net', 'onrequest']) - t.strictDeepEqual(aggregateNodeReady.mark.toJSON(), + t.strictSame(aggregateNodeReady.mark.toJSON(), ['nodecore', null, null]) - t.strictDeepEqual(aggregateNodeWriteWrap.mark.toJSON(), + t.strictSame(aggregateNodeWriteWrap.mark.toJSON(), ['nodecore', null, null]) - t.strictDeepEqual(aggregateNodeUnknownParent.mark.toJSON(), + t.strictSame(aggregateNodeUnknownParent.mark.toJSON(), ['user', null, null]) } @@ -117,7 +117,7 @@ test('Aggregate Node - mark http - tcp', function (t) { startpoint(aggregateNodesInput, { objectMode: true }) .pipe(new MarkHttpAggregateNodes()) .pipe(endpoint({ objectMode: true }, function (err, aggregateNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) checkTreeStructure(t, aggregateNodesOutput) t.end() })) @@ -129,7 +129,7 @@ test('Aggregate Node - mark http - pipe', function (t) { startpoint(aggregateNodesInput, { objectMode: true }) .pipe(new MarkHttpAggregateNodes()) .pipe(endpoint({ objectMode: true }, function (err, aggregateNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) checkTreeStructure(t, aggregateNodesOutput) t.end() })) diff --git a/test/analysis-aggregate-mark-module.test.js b/test/analysis-aggregate-mark-module.test.js index 5464fb44..f19b986f 100644 --- a/test/analysis-aggregate-mark-module.test.js +++ b/test/analysis-aggregate-mark-module.test.js @@ -72,24 +72,24 @@ test('Aggregate Node - mark module', function (t) { startpoint(aggregateNodesInput, { objectMode: true }) .pipe(new MarkModuleAggregateNodes(systemInfo)) .pipe(endpoint({ objectMode: true }, function (err, aggregateNodesOutput) { - if (err) return t.ifError(err) - t.strictDeepEqual( + if (err) return t.error(err) + t.strictSame( aggregateNodesOutput[0].mark.toJSON(), ['root', null, null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[1].mark.toJSON(), ['nodecore', null, null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[2].mark.toJSON(), ['user', null, null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[3].mark.toJSON(), ['external', 'deep', null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[4].mark.toJSON(), ['external', 'promise', null] ) diff --git a/test/analysis-aggregate-mark-party.test.js b/test/analysis-aggregate-mark-party.test.js index f43d43bc..f881b4cc 100644 --- a/test/analysis-aggregate-mark-party.test.js +++ b/test/analysis-aggregate-mark-party.test.js @@ -79,28 +79,28 @@ test('Aggregate Node - mark party', function (t) { startpoint(aggregateNodesInput, { objectMode: true }) .pipe(new MarkPartyAggregateNodes(systemInfo)) .pipe(endpoint({ objectMode: true }, function (err, aggregateNodesOutput) { - if (err) return t.ifError(err) - t.strictDeepEqual( + if (err) return t.error(err) + t.strictSame( aggregateNodesOutput[0].mark.toJSON(), ['root', null, null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[1].mark.toJSON(), ['nodecore', null, null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[2].mark.toJSON(), ['external', null, null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[3].mark.toJSON(), ['nodecore', null, null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[4].mark.toJSON(), ['external', null, null] ) - t.strictDeepEqual( + t.strictSame( aggregateNodesOutput[5].mark.toJSON(), ['user', null, null] ) diff --git a/test/analysis-aggregate.test.js b/test/analysis-aggregate.test.js index e533654c..0e332ad4 100644 --- a/test/analysis-aggregate.test.js +++ b/test/analysis-aggregate.test.js @@ -7,42 +7,42 @@ const { FakeAggregateNode, FakeSourceNode } = require('./analysis-util') test('Aggregate Node - aggregate.mark.format', function (t) { const aggregateNode = new AggregateNode(1, 0) - t.strictDeepEqual(util.inspect(aggregateNode.mark, { depth: -1 }), '') + t.strictSame(util.inspect(aggregateNode.mark, { depth: -1 }), '') - t.strictDeepEqual(aggregateNode.mark.format(), 'null') + t.strictSame(aggregateNode.mark.format(), 'null') aggregateNode.mark.set(0, 'party') - t.strictDeepEqual(aggregateNode.mark.format(), 'party') + t.strictSame(aggregateNode.mark.format(), 'party') aggregateNode.mark.set(1, 'module') - t.strictDeepEqual(aggregateNode.mark.format(), 'party.module') + t.strictSame(aggregateNode.mark.format(), 'party.module') aggregateNode.mark.set(2, 'name') - t.strictDeepEqual(aggregateNode.mark.format(), 'party.module.name') + t.strictSame(aggregateNode.mark.format(), 'party.module.name') const aggregateNodePartial = new AggregateNode(1, 0) aggregateNodePartial.mark.set(2, 'name') - t.strictDeepEqual(aggregateNodePartial.mark.format(), 'null') + t.strictSame(aggregateNodePartial.mark.format(), 'null') aggregateNodePartial.mark.set(0, 'party') - t.strictDeepEqual(aggregateNodePartial.mark.format(), 'party') + t.strictSame(aggregateNodePartial.mark.format(), 'party') t.end() }) test('Aggregate Node - aggregate.mark.inspect', function (t) { const aggregateNode = new AggregateNode(1, 0) - t.strictDeepEqual(util.inspect(aggregateNode.mark, { depth: -1 }), '') + t.strictSame(util.inspect(aggregateNode.mark, { depth: -1 }), '') - t.strictDeepEqual(util.inspect(aggregateNode.mark), '') + t.strictSame(util.inspect(aggregateNode.mark), '') aggregateNode.mark.set(0, 'party') - t.strictDeepEqual(util.inspect(aggregateNode.mark), '') + t.strictSame(util.inspect(aggregateNode.mark), '') aggregateNode.mark.set(1, 'module') - t.strictDeepEqual(util.inspect(aggregateNode.mark), '') + t.strictSame(util.inspect(aggregateNode.mark), '') aggregateNode.mark.set(2, 'name') - t.strictDeepEqual(util.inspect(aggregateNode.mark), '') + t.strictSame(util.inspect(aggregateNode.mark), '') const aggregateNodePartial = new AggregateNode(1, 0) aggregateNodePartial.mark.set(2, 'name') - t.strictDeepEqual(util.inspect(aggregateNodePartial.mark), '') + t.strictSame(util.inspect(aggregateNodePartial.mark), '') aggregateNodePartial.mark.set(0, 'party') - t.strictDeepEqual(util.inspect(aggregateNodePartial.mark), '') + t.strictSame(util.inspect(aggregateNodePartial.mark), '') t.end() }) @@ -50,13 +50,13 @@ test('Aggregate Node - aggregate.mark.inspect', function (t) { test('Aggregate Node - aggregate.mark.toJSON', function (t) { const aggregateNode = new AggregateNode(1, 0) - t.strictDeepEqual(aggregateNode.mark.toJSON(), [null, null, null]) + t.strictSame(aggregateNode.mark.toJSON(), [null, null, null]) aggregateNode.mark.set(0, 'party') - t.strictDeepEqual(aggregateNode.mark.toJSON(), ['party', null, null]) + t.strictSame(aggregateNode.mark.toJSON(), ['party', null, null]) aggregateNode.mark.set(1, 'module') - t.strictDeepEqual(aggregateNode.mark.toJSON(), ['party', 'module', null]) + t.strictSame(aggregateNode.mark.toJSON(), ['party', 'module', null]) aggregateNode.mark.set(2, 'name') - t.strictDeepEqual(aggregateNode.mark.toJSON(), ['party', 'module', 'name']) + t.strictSame(aggregateNode.mark.toJSON(), ['party', 'module', 'name']) t.end() }) @@ -67,7 +67,7 @@ test('Aggregate Node - aggregate.mark.set', function (t) { aggregateNode.mark.set(0, 'party') aggregateNode.mark.set(1, 'module') aggregateNode.mark.set(2, 'name') - t.strictDeepEqual(aggregateNode.mark.toJSON(), ['party', 'module', 'name']) + t.strictSame(aggregateNode.mark.toJSON(), ['party', 'module', 'name']) t.throws( () => aggregateNode.mark.set(3, 'extra'), @@ -84,9 +84,9 @@ test('Aggregate Node - aggregate.mark.get', function (t) { aggregateNode.mark.set(1, 'module') aggregateNode.mark.set(2, 'name') - t.strictEqual(aggregateNode.mark.get(0), 'party') - t.strictEqual(aggregateNode.mark.get(1), 'module') - t.strictEqual(aggregateNode.mark.get(2), 'name') + t.equal(aggregateNode.mark.get(0), 'party') + t.equal(aggregateNode.mark.get(1), 'module') + t.equal(aggregateNode.mark.get(2), 'name') t.throws( () => aggregateNode.mark.get(3), @@ -108,7 +108,7 @@ test('Aggregate Node - aggregate.inspect', function (t) { ] }) - t.strictEqual( + t.equal( util.inspect(aggregateNode, { depth: null }), ',' + ' aggregateId:2, parentAggregateId:1, sources.length:1,' + @@ -116,7 +116,7 @@ test('Aggregate Node - aggregate.inspect', function (t) { ' fileName.js:>]>>' ) - t.strictEqual( + t.equal( util.inspect(aggregateNode, { depth: 2 }), ',' + ' aggregateId:2, parentAggregateId:1, sources.length:1,' + @@ -124,21 +124,21 @@ test('Aggregate Node - aggregate.inspect', function (t) { ' fileName.js:>]>>' ) - t.strictEqual( + t.equal( util.inspect(aggregateNode, { depth: 1 }), ',' + ' aggregateId:2, parentAggregateId:1, sources.length:1,' + ' children:[1, 2, 3], frames:]>>' ) - t.strictEqual( + t.equal( util.inspect(aggregateNode, { depth: 0 }), ',' + ' aggregateId:2, parentAggregateId:1, sources.length:1,' + ' children:[1, 2, 3], frames:>' ) - t.strictEqual( + t.equal( util.inspect(aggregateNode, { depth: -1 }), '' ) @@ -158,7 +158,7 @@ test('Aggregate Node - aggregate.inspect', function (t) { ] }) - t.strictDeepEqual(aggregateNode.toJSON(), { + t.strictSame(aggregateNode.toJSON(), { aggregateId: 2, parentAggregateId: 1, children: [1, 2, 3], @@ -178,8 +178,8 @@ test('Aggregate Node - aggregate.makeRoot', function (t) { const aggregateNode = new AggregateNode(1, 0) aggregateNode.makeRoot() - t.strictEqual(aggregateNode.isRoot, true) - t.strictDeepEqual(aggregateNode.toJSON(), { + t.equal(aggregateNode.isRoot, true) + t.strictSame(aggregateNode.toJSON(), { aggregateId: 1, parentAggregateId: 0, children: [], @@ -206,10 +206,10 @@ test('Aggregate Node - aggregate.addChild', function (t) { const aggregateNode = new AggregateNode(1, 0) aggregateNode.addChild(1) - t.strictDeepEqual(aggregateNode.toJSON().children, [1]) + t.strictSame(aggregateNode.toJSON().children, [1]) aggregateNode.addChild(2) - t.strictDeepEqual(aggregateNode.toJSON().children, [1, 2]) + t.strictSame(aggregateNode.toJSON().children, [1, 2]) t.end() }) @@ -218,10 +218,10 @@ test('Aggregate Node - aggregate.getChildren', function (t) { const aggregateNode = new AggregateNode(1, 0) aggregateNode.addChild(1) - t.strictDeepEqual(aggregateNode.getChildren(), [1]) + t.strictSame(aggregateNode.getChildren(), [1]) aggregateNode.addChild(2) - t.strictDeepEqual(aggregateNode.getChildren(), [1, 2]) + t.strictSame(aggregateNode.getChildren(), [1, 2]) t.end() }) @@ -256,7 +256,7 @@ test('Aggregate Node - aggregate.addSourceNode', function (t) { const aggregateNode = new AggregateNode(1, 0) aggregateNode.addSourceNode(sourceNodeA) - t.strictDeepEqual(aggregateNode.toJSON(), { + t.strictSame(aggregateNode.toJSON(), { aggregateId: 1, parentAggregateId: 0, children: [], @@ -270,7 +270,7 @@ test('Aggregate Node - aggregate.addSourceNode', function (t) { }) aggregateNode.addSourceNode(sourceNodeB) - t.strictDeepEqual(aggregateNode.toJSON(), { + t.strictSame(aggregateNode.toJSON(), { aggregateId: 1, parentAggregateId: 0, children: [], @@ -319,10 +319,10 @@ test('Aggregate Node - aggregate.addSourceNode', function (t) { const aggregateNode = new AggregateNode(1, 0) aggregateNode.addSourceNode(sourceNodeA) - t.strictDeepEqual(aggregateNode.getSourceNodes(), [sourceNodeA]) + t.strictSame(aggregateNode.getSourceNodes(), [sourceNodeA]) aggregateNode.addSourceNode(sourceNodeB) - t.strictDeepEqual(aggregateNode.getSourceNodes(), [ + t.strictSame(aggregateNode.getSourceNodes(), [ sourceNodeA, sourceNodeB ]) diff --git a/test/analysis-barrier-make-external.test.js b/test/analysis-barrier-make-external.test.js index 47614224..be5335d3 100644 --- a/test/analysis-barrier-make-external.test.js +++ b/test/analysis-barrier-make-external.test.js @@ -165,7 +165,7 @@ function checkTreeStructure (t, barrierNodes) { barrierNodeParentBothChildExternal ] = barrierNodes - t.strictDeepEqual(extractState(barrierNodeRoot), { + t.strictSame(extractState(barrierNodeRoot), { barrierId: 1, parentBarrierId: 0, isWrapper: true, @@ -173,7 +173,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [1] }) - t.strictDeepEqual(extractState(barrierNodeParentUser), { + t.strictSame(extractState(barrierNodeParentUser), { barrierId: 2, parentBarrierId: 1, isWrapper: true, @@ -181,7 +181,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [2] }) - t.strictDeepEqual(extractState(barrierNodeParentExternal), { + t.strictSame(extractState(barrierNodeParentExternal), { barrierId: 3, parentBarrierId: 1, isWrapper: false, @@ -189,7 +189,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [3] }) - t.strictDeepEqual(extractState(barrierNodeParentBoth), { + t.strictSame(extractState(barrierNodeParentBoth), { barrierId: 4, parentBarrierId: 1, isWrapper: false, @@ -197,7 +197,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [4, 5] }) - t.strictDeepEqual(extractState(barrierNodeParentUserChildUser), { + t.strictSame(extractState(barrierNodeParentUserChildUser), { barrierId: 6, parentBarrierId: 2, isWrapper: true, @@ -205,7 +205,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [6] }) - t.strictDeepEqual(extractState(barrierNodeParentUserChildExternal), { + t.strictSame(extractState(barrierNodeParentUserChildExternal), { barrierId: 7, parentBarrierId: 2, isWrapper: false, @@ -213,7 +213,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [7] }) - t.strictDeepEqual(extractState(barrierNodeParentExternalChildUser), { + t.strictSame(extractState(barrierNodeParentExternalChildUser), { barrierId: 8, parentBarrierId: 3, isWrapper: false, @@ -221,7 +221,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [8] }) - t.strictDeepEqual(extractState(barrierNodeParentExternalChildExternal), { + t.strictSame(extractState(barrierNodeParentExternalChildExternal), { barrierId: 9, parentBarrierId: 3, isWrapper: true, @@ -229,7 +229,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [9] }) - t.strictDeepEqual(extractState(barrierNodeParentBothChildUser), { + t.strictSame(extractState(barrierNodeParentBothChildUser), { barrierId: 10, parentBarrierId: 4, isWrapper: true, @@ -237,7 +237,7 @@ function checkTreeStructure (t, barrierNodes) { nodes: [10] }) - t.strictDeepEqual(extractState(barrierNodeParentBothChildExternal), { + t.strictSame(extractState(barrierNodeParentBothChildExternal), { barrierId: 11, parentBarrierId: 4, isWrapper: true, @@ -253,7 +253,7 @@ test('Barrier Node - make external', function (t) { startpoint(barrierNodesInput, { objectMode: true }) .pipe(new MakeExternalBarrierNode(systemInfo)) .pipe(endpoint({ objectMode: true }, function (err, barrierNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) checkTreeStructure(t, barrierNodesOutput) t.end() diff --git a/test/analysis-barrier-make-synchronous-barrier-parent.test.js b/test/analysis-barrier-make-synchronous-barrier-parent.test.js index fd74414d..6755ea12 100644 --- a/test/analysis-barrier-make-synchronous-barrier-parent.test.js +++ b/test/analysis-barrier-make-synchronous-barrier-parent.test.js @@ -113,31 +113,31 @@ test('Barrier Node - make synchronous - BarrierNode parrent', function (t) { .pipe(new WrapAsBarrierNodes()) .pipe(new MakeSynchronousBarrierNodes(systemInfo)) .pipe(endpoint({ objectMode: true }, function (err, data) { - t.ifError(err) + t.error(err) const barrierNodes = new Map( data.map((barrierNode) => [barrierNode.barrierId, barrierNode]) ) - t.strictDeepEqual(getBarrierNodeEssentials(barrierNodes.get(1)), { + t.strictSame(getBarrierNodeEssentials(barrierNodes.get(1)), { barrierId: 1, children: [10], nodes: [1], isWrapper: true }) - t.strictDeepEqual(getBarrierNodeEssentials(barrierNodes.get(10)), { + t.strictSame(getBarrierNodeEssentials(barrierNodes.get(10)), { barrierId: 10, children: [12, 13], nodes: [10, 11], isWrapper: false }) - t.strictDeepEqual(getBarrierNodeEssentials(barrierNodes.get(12)), { + t.strictSame(getBarrierNodeEssentials(barrierNodes.get(12)), { barrierId: 12, children: [], nodes: [12], isWrapper: true }) - t.strictDeepEqual(getBarrierNodeEssentials(barrierNodes.get(13)), { + t.strictSame(getBarrierNodeEssentials(barrierNodes.get(13)), { barrierId: 13, children: [], nodes: [13], diff --git a/test/analysis-barrier-make-synchronous.test.js b/test/analysis-barrier-make-synchronous.test.js index 4f5a80e3..af2d9e1e 100644 --- a/test/analysis-barrier-make-synchronous.test.js +++ b/test/analysis-barrier-make-synchronous.test.js @@ -217,49 +217,49 @@ function checkTreeStructure (t, barrierNodes) { barrierNodeRemappend ] = barrierNodes - t.strictDeepEqual(extractState(barrierNodeRoot), { + t.strictSame(extractState(barrierNodeRoot), { barrierId: 1, parentBarrierId: 0, isWrapper: true, children: [2], nodes: [1] }) - t.strictDeepEqual(extractState(barrierNodeParent), { + t.strictSame(extractState(barrierNodeParent), { barrierId: 2, parentBarrierId: 1, isWrapper: true, children: [3, 4, 6, 7], nodes: [2] }) - t.strictDeepEqual(extractState(barrierNodeBarrier), { + t.strictSame(extractState(barrierNodeBarrier), { barrierId: 3, parentBarrierId: 2, isWrapper: false, children: [], nodes: [3] }) - t.strictDeepEqual(extractState(barrierNodeBranchA), { + t.strictSame(extractState(barrierNodeBranchA), { barrierId: 4, parentBarrierId: 2, isWrapper: false, children: [], nodes: [4, 5] }) - t.strictDeepEqual(extractState(barrierNodeWrapper), { + t.strictSame(extractState(barrierNodeWrapper), { barrierId: 6, parentBarrierId: 2, isWrapper: true, children: [], nodes: [6] }) - t.strictDeepEqual(extractState(barrierNodeBranchB), { + t.strictSame(extractState(barrierNodeBranchB), { barrierId: 7, parentBarrierId: 2, isWrapper: false, children: [9], nodes: [7, 8] }) - t.strictDeepEqual(extractState(barrierNodeRemappend), { + t.strictSame(extractState(barrierNodeRemappend), { barrierId: 9, parentBarrierId: 7, isWrapper: true, @@ -275,7 +275,7 @@ test('Barrier Node - make synchronous', function (t) { startpoint(barrierNodesInput, { objectMode: true }) .pipe(new MakeSynchronousBarrierNodes(systemInfo)) .pipe(endpoint({ objectMode: true }, function (err, barrierNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) checkTreeStructure(t, barrierNodesOutput) t.end() diff --git a/test/analysis-barrier-name-barrier-nodes.test.js b/test/analysis-barrier-name-barrier-nodes.test.js index 142ef3d2..9df22c3f 100644 --- a/test/analysis-barrier-name-barrier-nodes.test.js +++ b/test/analysis-barrier-name-barrier-nodes.test.js @@ -93,9 +93,9 @@ test('Barrier Node - set name', function (t) { barrierNodeParentExternal, barrierNodeParentBoth ], function (err, names) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.deepEquals(names, [ + t.same(names, [ 'miscellaneous', 'setImmediate', 'external', @@ -198,9 +198,9 @@ test('Barrier Node - set name with multiple modules in stack', function (t) { barrierNodeParentExternal, barrierNodeParentBoth ], function (err, names) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.deepEquals(names, [ + t.same(names, [ 'miscellaneous', 'setImmediate', 'external > other-external', @@ -307,9 +307,9 @@ test('Barrier Node - set name with too many modules in stack', function (t) { barrierNodeParentExternal, barrierNodeParentBoth ], function (err, names) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.deepEquals(names, [ + t.same(names, [ 'miscellaneous', 'setImmediate', '... > c > d > e', @@ -422,9 +422,9 @@ test('Barrier Node - set long name', function (t) { barrierNodeRoot, barrierNodeManyNodesOneType ], function (err, names) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.deepEquals(names, [ + t.same(names, [ 'miscellaneous', 'setImmediate' ]) @@ -433,9 +433,9 @@ test('Barrier Node - set long name', function (t) { barrierNodeRoot, barrierNodeManyNodesManyTypes ], function (err, names) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.deepEquals(names, [ + t.same(names, [ 'miscellaneous', 'setImmediate + nextTick + timeout + http + ...' ]) @@ -452,8 +452,8 @@ test('Barrier Node - http server', function (t) { ]) pipeline(nodes, function (err, names) { - if (err) return t.ifError(err) - t.deepEquals(names, [ + if (err) return t.error(err) + t.same(names, [ 'http.server', // root swaps with http server child 'http.server', 'http' @@ -471,8 +471,8 @@ test('Barrier Node - http server with connection', function (t) { ]) pipeline(nodes, function (err, names) { - if (err) return t.ifError(err) - t.deepEquals(names, [ + if (err) return t.error(err) + t.same(names, [ 'http.server', // root swaps with http server child 'http.server', 'http.connection', @@ -491,8 +491,8 @@ test('Barrier Node - tcp server', function (t) { ]) pipeline(nodes, function (err, names) { - if (err) return t.ifError(err) - t.deepEquals(names, [ + if (err) return t.error(err) + t.same(names, [ 'server', // root swaps with http server child 'server', 'connection', @@ -510,8 +510,8 @@ test('Barrier Node - http connect', function (t) { ]) pipeline(nodes, function (err, names) { - if (err) return t.ifError(err) - t.deepEquals(names, [ + if (err) return t.error(err) + t.same(names, [ 'miscellaneous', 'http.connection.connect', 'http', @@ -523,20 +523,20 @@ test('Barrier Node - http connect', function (t) { test('Barrier Node - simple types', function (t) { pipeline(createNodes(['FSREQWRAP']), function (err, names) { - if (err) return t.ifError(err) - t.deepEquals(names, [ + if (err) return t.error(err) + t.same(names, [ 'miscellaneous', 'fs' ]) pipeline(createNodes(['PROMISE']), function (err, names) { - if (err) return t.ifError(err) - t.deepEquals(names, [ + if (err) return t.error(err) + t.same(names, [ 'miscellaneous', 'promise' ]) pipeline(createNodes(['RANDOMBYTESREQUEST']), function (err, names) { - if (err) return t.ifError(err) - t.deepEquals(names, [ + if (err) return t.error(err) + t.same(names, [ 'miscellaneous', 'random-bytes' ]) diff --git a/test/analysis-barrier-wrap.test.js b/test/analysis-barrier-wrap.test.js index 9d821509..8d6ac834 100644 --- a/test/analysis-barrier-wrap.test.js +++ b/test/analysis-barrier-wrap.test.js @@ -18,9 +18,9 @@ test('Barrier Node - wrap', function (t) { startpoint([aggregateNode], { objectMode: true }) .pipe(new WrapAsBarrierNode()) .pipe(endpoint({ objectMode: true }, function (err, nodes) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.strictDeepEqual(nodes[0].toJSON(), { + t.strictSame(nodes[0].toJSON(), { barrierId: 2, parentBarrierId: 1, children: [3, 4], diff --git a/test/analysis-barrier.test.js b/test/analysis-barrier.test.js index 11fac2e3..1d7b1c20 100644 --- a/test/analysis-barrier.test.js +++ b/test/analysis-barrier.test.js @@ -95,7 +95,7 @@ test('Barrier Node - barrier.inspect', function (t) { }] }) - t.strictEqual( + t.equal( util.inspect(barrierNodeNamed, { depth: null }), ']>>]>' ) - t.strictEqual( + t.equal( util.inspect(barrierNodeWrapper, { depth: null }), ']>>]>' ) - t.strictEqual( + t.equal( util.inspect(barrierNodeWrapper, { depth: 3 }), ']>>]>' ) - t.strictEqual( + t.equal( util.inspect(barrierNodeWrapper, { depth: 0 }), ']>' ) - t.strictEqual( + t.equal( util.inspect(barrierNodeWrapper, { depth: -1 }), '' ) - t.strictEqual( + t.equal( util.inspect(barrierNodeCombined, { depth: 3 }), ']>>]>' ) - t.strictEqual( + t.equal( util.inspect(barrierNodeCombined, { depth: 0 }), ', aggregateId:2,' + @@ -60,7 +60,7 @@ test('Cluster Node - cluster.inspect', function (t) { ' ]>>]>' ) - t.strictEqual( + t.equal( util.inspect(clusterNode, { depth: 3 }), ', aggregateId:2,' + @@ -75,7 +75,7 @@ test('Cluster Node - cluster.inspect', function (t) { ' ]>>]>' ) - t.strictEqual( + t.equal( util.inspect(clusterNode, { depth: 2 }), ', aggregateId:2,' + @@ -86,7 +86,7 @@ test('Cluster Node - cluster.inspect', function (t) { ' children:[4, 5], frames:, ]>>]>' ) - t.strictEqual( + t.equal( util.inspect(clusterNode, { depth: 1 }), ', aggregateId:2,' + @@ -97,13 +97,13 @@ test('Cluster Node - cluster.inspect', function (t) { ' children:[4, 5], frames:>]>' ) - t.strictEqual( + t.equal( util.inspect(clusterNode, { depth: 0 }), ', ]>' ) - t.strictEqual( + t.equal( util.inspect(clusterNode, { depth: -1 }), '' ) @@ -125,7 +125,7 @@ test('Cluster Node - cluster.toJSON', function (t) { }] }) - t.strictDeepEqual(clusterNode.toJSON(), { + t.strictSame(clusterNode.toJSON(), { clusterId: 2, parentClusterId: 1, name: null, @@ -148,17 +148,17 @@ test('Cluster Node - cluster.toJSON', function (t) { test('Cluster Node - cluster.makeRoot', function (t) { const clusterNode = new ClusterNode(1, 0) clusterNode.makeRoot() - t.strictEqual(clusterNode.isRoot, true) + t.equal(clusterNode.isRoot, true) t.end() }) test('Cluster Node - cluster.addChild', function (t) { const clusterNode = new ClusterNode(2, 1) - t.strictDeepEqual(clusterNode.children, []) + t.strictSame(clusterNode.children, []) clusterNode.addChild(3) - t.strictDeepEqual(clusterNode.children, [3]) + t.strictSame(clusterNode.children, [3]) clusterNode.addChild(5) - t.strictDeepEqual(clusterNode.children, [3, 5]) + t.strictSame(clusterNode.children, [3, 5]) t.end() }) @@ -201,7 +201,7 @@ test('Cluster Node - cluster.insertBarrierNode', function (t) { clusterNodeForward.insertBarrierNode(barrierNodeCombined) clusterNodeForward.insertBarrierNode(barrierNodeWrapper) clusterNodeForward.sort() - t.strictDeepEqual( + t.strictSame( clusterNodeForward.nodes.map((aggregateNode) => aggregateNode.aggregateId), [2, 3, 6] ) @@ -210,7 +210,7 @@ test('Cluster Node - cluster.insertBarrierNode', function (t) { clusterNodeBackward.insertBarrierNode(barrierNodeWrapper) clusterNodeBackward.insertBarrierNode(barrierNodeCombined) clusterNodeBackward.sort() - t.strictDeepEqual( + t.strictSame( clusterNodeBackward.nodes.map((aggregateNode) => aggregateNode.aggregateId), [2, 3, 6] ) @@ -258,14 +258,14 @@ test('Cluster Node - name from barrier node', function (t) { const clusterNodeForward = new ClusterNode(2, 1) clusterNodeForward.insertBarrierNode(barrierNodeCombined) clusterNodeForward.insertBarrierNode(barrierNodeWrapper) - t.strictEqual(clusterNodeForward.name, 'barrier-combined') + t.equal(clusterNodeForward.name, 'barrier-combined') const clusterNodeBackward = new ClusterNode(2, 1) clusterNodeBackward.insertBarrierNode(barrierNodeWrapper) clusterNodeBackward.insertBarrierNode(barrierNodeCombined) - t.strictEqual(clusterNodeForward.name, 'barrier-combined') + t.equal(clusterNodeForward.name, 'barrier-combined') - t.strictEqual( + t.equal( util.inspect(clusterNodeForward, { depth: 0 }), ', , ]>' diff --git a/test/analysis-raw-event-join.test.js b/test/analysis-raw-event-join.test.js index 975467d2..a008f562 100644 --- a/test/analysis-raw-event-join.test.js +++ b/test/analysis-raw-event-join.test.js @@ -87,9 +87,9 @@ test('Raw Event - join order', function (t) { new JoinAsRawEvent(stackTrace, traceEvent) .pipe(endpoint({ objectMode: true }, function (err, data) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.strictDeepEqual(data.map((rawEvent) => rawEvent.toJSON()), [ + t.strictSame(data.map((rawEvent) => rawEvent.toJSON()), [ { type: 'traceEvent', asyncId: 1, info: traceEventData[0].toJSON() }, { type: 'stackTrace', asyncId: 1, info: stackTraceData[0].toJSON() }, { type: 'traceEvent', asyncId: 1, info: traceEventData[1].toJSON() }, @@ -142,9 +142,9 @@ test('Raw Event - join with earily stackTrace end', function (t) { new JoinAsRawEvent(stackTrace, traceEvent) .pipe(endpoint({ objectMode: true }, function (err, data) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.strictDeepEqual(data.map((rawEvent) => rawEvent.toJSON()), [ + t.strictSame(data.map((rawEvent) => rawEvent.toJSON()), [ { type: 'traceEvent', asyncId: 1, info: traceEventData[0].toJSON() }, { type: 'stackTrace', asyncId: 1, info: stackTraceData[0].toJSON() }, { type: 'traceEvent', asyncId: 2, info: traceEventData[1].toJSON() }, @@ -184,9 +184,9 @@ test('Raw Event - join with earily traceEvent end', function (t) { new JoinAsRawEvent(stackTrace, traceEvent) .pipe(endpoint({ objectMode: true }, function (err, data) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.strictDeepEqual(data.map((rawEvent) => rawEvent.toJSON()), [ + t.strictSame(data.map((rawEvent) => rawEvent.toJSON()), [ { type: 'traceEvent', asyncId: 1, info: traceEventData[0].toJSON() }, { type: 'stackTrace', asyncId: 1, info: stackTraceData[0].toJSON() }, { type: 'traceEvent', asyncId: 1, info: traceEventData[1].toJSON() }, @@ -226,9 +226,9 @@ test('Raw Event - read before available', function (t) { async.series([ function awaitTraceEvent (done) { - t.strictEqual(join.read(), null) + t.equal(join.read(), null) join.once('readable', function () { - t.strictDeepEqual( + t.strictSame( join.read().toJSON(), { type: 'traceEvent', asyncId: 1, info: traceEventData[0].toJSON() } ) @@ -238,9 +238,9 @@ test('Raw Event - read before available', function (t) { }, function awaitStackTrace (done) { - t.strictEqual(join.read(), null) + t.equal(join.read(), null) join.once('readable', function () { - t.strictDeepEqual( + t.strictSame( join.read().toJSON(), { type: 'stackTrace', asyncId: 1, info: stackTraceData[0].toJSON() } ) @@ -250,9 +250,9 @@ test('Raw Event - read before available', function (t) { }, function awaitTraceEvent (done) { - t.strictEqual(join.read(), null) + t.equal(join.read(), null) join.once('readable', function () { - t.strictDeepEqual( + t.strictSame( join.read().toJSON(), { type: 'traceEvent', asyncId: 1, info: traceEventData[1].toJSON() } ) @@ -261,7 +261,7 @@ test('Raw Event - read before available', function (t) { traceEvent.write(traceEventData[1]) } ], function (err) { - if (err) return t.ifError(err) + if (err) return t.error(err) t.end() }) }) @@ -276,9 +276,9 @@ test('Raw Event - end switches stream', function (t) { const join = new JoinAsRawEvent(stackTrace, traceEvent) stackTrace.write(stackTraceData[0]) - t.strictEqual(join.read(), null) + t.equal(join.read(), null) join.once('readable', function () { - t.strictDeepEqual( + t.strictSame( join.read().toJSON(), { type: 'stackTrace', asyncId: 1, info: stackTraceData[0].toJSON() } ) diff --git a/test/analysis-raw-event.test.js b/test/analysis-raw-event.test.js index e6a62d8c..4f1e1eb6 100644 --- a/test/analysis-raw-event.test.js +++ b/test/analysis-raw-event.test.js @@ -16,7 +16,7 @@ test('Raw Event - RawEvent.wrapTraceEvent', function (t) { executionAsyncId: 0 }) - t.strictDeepEqual(RawEvent.wrapTraceEvent(traceEventObject).toJSON(), { + t.strictSame(RawEvent.wrapTraceEvent(traceEventObject).toJSON(), { type: 'traceEvent', asyncId: 2, info: traceEventObject.toJSON() @@ -41,7 +41,7 @@ test('Raw Event - RawEvent.wrapStackTrace', function (t) { executionAsyncId: 0 }) - t.strictDeepEqual(RawEvent.wrapStackTrace(stackTraceObject).toJSON(), { + t.strictSame(RawEvent.wrapStackTrace(stackTraceObject).toJSON(), { type: 'stackTrace', asyncId: 2, info: stackTraceObject.toJSON() diff --git a/test/analysis-source-combine.test.js b/test/analysis-source-combine.test.js index 2213f42e..58c5902f 100644 --- a/test/analysis-source-combine.test.js +++ b/test/analysis-source-combine.test.js @@ -63,13 +63,13 @@ test('Source Node - combine', function (t) { joined .pipe(new CombineAsSourceNodes()) .pipe(endpoint({ objectMode: true }, function (err, data) { - if (err) return t.ifError(err) + if (err) return t.error(err) const sourceNodes = new Map(data.map((node) => [node.asyncId, node])) - t.strictEqual(data.length, 3) - t.strictEqual(sourceNodes.size, 3) + t.equal(data.length, 3) + t.equal(sourceNodes.size, 3) - t.strictDeepEqual(sourceNodes.get(1).toJSON(), { + t.strictSame(sourceNodes.get(1).toJSON(), { asyncId: 1, triggerAsyncId: 0, executionAsyncId: 0, @@ -83,7 +83,7 @@ test('Source Node - combine', function (t) { destroy: 4 }) - t.strictDeepEqual(sourceNodes.get(2).toJSON(), { + t.strictSame(sourceNodes.get(2).toJSON(), { asyncId: 2, triggerAsyncId: 1, executionAsyncId: 1, @@ -97,7 +97,7 @@ test('Source Node - combine', function (t) { destroy: 6 }) - t.strictDeepEqual(sourceNodes.get(3).toJSON(), { + t.strictSame(sourceNodes.get(3).toJSON(), { asyncId: 3, triggerAsyncId: 1, executionAsyncId: 1, diff --git a/test/analysis-source-filter.test.js b/test/analysis-source-filter.test.js index a521ec2b..77f24e68 100644 --- a/test/analysis-source-filter.test.js +++ b/test/analysis-source-filter.test.js @@ -39,10 +39,10 @@ test('Source Node - filter', function (t) { startpoint([nodeNotFiltered, nodeNoStack, nodeTimer], { objectMode: true }) .pipe(new FilterSourceNodes()) .pipe(endpoint({ objectMode: true }, function (err, nodes) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.strictEqual(nodes.length, 1) - t.strictEqual(nodes[0], nodeNotFiltered) + t.equal(nodes.length, 1) + t.equal(nodes[0], nodeNotFiltered) t.end() })) }) diff --git a/test/analysis-source-http-requests.test.js b/test/analysis-source-http-requests.test.js index 1c1e1319..bfd73b2c 100644 --- a/test/analysis-source-http-requests.test.js +++ b/test/analysis-source-http-requests.test.js @@ -41,8 +41,8 @@ test('Source Node - http requests', function (t) { stream.resume() stream.on('end', function () { - t.strictEquals(digest.runtime, 2) - t.deepEquals(digest.httpRequests, [1]) + t.equal(digest.runtime, 2) + t.same(digest.httpRequests, [1]) t.end() }) }) diff --git a/test/analysis-source-indentify.test.js b/test/analysis-source-indentify.test.js index 1f410984..ae7fc95c 100644 --- a/test/analysis-source-indentify.test.js +++ b/test/analysis-source-indentify.test.js @@ -96,32 +96,32 @@ test('Source Node - indentify', function (t) { startpoint(sourceNodesInput, { objectMode: true }) .pipe(new IdentifySourceNodes()) .pipe(endpoint({ objectMode: true }, function (err, sourceNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) for (const sourceNode of sourceNodesOutput) { - t.strictEqual(typeof sourceNode.identifier, 'string') + t.equal(typeof sourceNode.identifier, 'string') t.ok(sourceNode.identifier.length > 0) } - t.strictEqual( + t.equal( sourceNodesOutput[0].identifier, // sourceNodeHttpParserA sourceNodesOutput[1].identifier, // sourceNodeHttpParserB 'HTTPPARSER ignores frames' ) - t.notStrictEquals( + t.not( sourceNodesOutput[2].identifier, // sourceNodeNoFramesA sourceNodesOutput[3].identifier, // sourceNodeNoFramesB 'Without frames the type matters' ) - t.notStrictEquals( + t.not( sourceNodesOutput[4].identifier, // sourceNodeWithFramesA sourceNodesOutput[5].identifier, // sourceNodeWithFramesB 'With frames the type matters' ) - t.notStrictEquals( + t.not( sourceNodesOutput[5].identifier, // sourceNodeWithFramesB sourceNodesOutput[6].identifier, // sourceNodeWithFramesC 'With frames the frames matters' diff --git a/test/analysis-source-restructure-net.test.js b/test/analysis-source-restructure-net.test.js index 7e2126d6..19162575 100644 --- a/test/analysis-source-restructure-net.test.js +++ b/test/analysis-source-restructure-net.test.js @@ -102,13 +102,13 @@ function checkTreeStructure (t, sourceNodes) { const sourceNodeWriteWrap = sourceNodeIndex.get(6) const sourceNodeUnknownParent = sourceNodeIndex.get(7) - t.strictEqual(sourceNodeRoot.parentAsyncId, 0) - t.strictEqual(sourceNodeServer.parentAsyncId, 1) - t.strictEqual(sourceNodeSocket.parentAsyncId, 2) - t.strictEqual(sourceNodeHttpParser.parentAsyncId, 3) - t.strictEqual(sourceNodeReady.parentAsyncId, 4) - t.strictEqual(sourceNodeWriteWrap.parentAsyncId, 5) - t.strictEqual(sourceNodeUnknownParent.parentAsyncId, 10) + t.equal(sourceNodeRoot.parentAsyncId, 0) + t.equal(sourceNodeServer.parentAsyncId, 1) + t.equal(sourceNodeSocket.parentAsyncId, 2) + t.equal(sourceNodeHttpParser.parentAsyncId, 3) + t.equal(sourceNodeReady.parentAsyncId, 4) + t.equal(sourceNodeWriteWrap.parentAsyncId, 5) + t.equal(sourceNodeUnknownParent.parentAsyncId, 10) } test('Source Node - restructure net - tcp right order', function (t) { @@ -117,7 +117,7 @@ test('Source Node - restructure net - tcp right order', function (t) { startpoint(sourceNodesInput, { objectMode: true }) .pipe(new RestructureNetSourceNodes()) .pipe(endpoint({ objectMode: true }, function (err, sourceNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) checkTreeStructure(t, sourceNodesOutput) t.end() })) @@ -130,7 +130,7 @@ test('Source Node - restructure net - tcp wrong order', function (t) { startpoint(sourceNodesInput, { objectMode: true }) .pipe(new RestructureNetSourceNodes()) .pipe(endpoint({ objectMode: true }, function (err, sourceNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) checkTreeStructure(t, sourceNodesOutput) t.end() })) @@ -142,7 +142,7 @@ test('Source Node - restructure net - pipe right order', function (t) { startpoint(sourceNodesInput, { objectMode: true }) .pipe(new RestructureNetSourceNodes()) .pipe(endpoint({ objectMode: true }, function (err, sourceNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) checkTreeStructure(t, sourceNodesOutput) t.end() })) @@ -155,7 +155,7 @@ test('Source Node - restructure net - pipe wrong order', function (t) { startpoint(sourceNodesInput, { objectMode: true }) .pipe(new RestructureNetSourceNodes()) .pipe(endpoint({ objectMode: true }, function (err, sourceNodesOutput) { - if (err) return t.ifError(err) + if (err) return t.error(err) checkTreeStructure(t, sourceNodesOutput) t.end() })) diff --git a/test/analysis-source.test.js b/test/analysis-source.test.js index 46b46492..a5e804f0 100644 --- a/test/analysis-source.test.js +++ b/test/analysis-source.test.js @@ -24,13 +24,13 @@ test('Source Node - sourceNode.inspect', function (t) { destroy: 6 }) - t.strictEqual( + t.equal( util.inspect(sourceNode), '' ) sourceNode.setIdentifier('string will be the id') - t.strictEqual( + t.equal( util.inspect(sourceNode), '' @@ -57,7 +57,7 @@ test('Source Node - sourceNode.toJSON', function (t) { asyncId: 2 }) - t.strictDeepEqual(sourceNodeNoData.toJSON(), { + t.strictSame(sourceNodeNoData.toJSON(), { asyncId: 2, frames: null, type: null, @@ -71,7 +71,7 @@ test('Source Node - sourceNode.toJSON', function (t) { destroy: null }) - t.strictDeepEqual(sourceNodeNoData.toJSON({ short: true }), { + t.strictSame(sourceNodeNoData.toJSON({ short: true }), { asyncId: 2, parentAsyncId: null, triggerAsyncId: null, @@ -82,7 +82,7 @@ test('Source Node - sourceNode.toJSON', function (t) { destroy: null }) - t.strictDeepEqual(sourceNode.toJSON(), { + t.strictSame(sourceNode.toJSON(), { asyncId: 2, frames: [ { fileName: 'fileName.js' } @@ -98,7 +98,7 @@ test('Source Node - sourceNode.toJSON', function (t) { destroy: 6 }) - t.strictDeepEqual(sourceNode.toJSON({ short: true }), { + t.strictSame(sourceNode.toJSON({ short: true }), { asyncId: 2, parentAsyncId: 1, triggerAsyncId: 1, @@ -116,7 +116,7 @@ test('Source Node - sourceNode.makeRoot', function (t) { const sourceNodeRoot = new SourceNode(0) sourceNodeRoot.makeRoot() - t.strictDeepEqual(sourceNodeRoot.toJSON(), { + t.strictSame(sourceNodeRoot.toJSON(), { asyncId: 0, frames: [], type: null, @@ -136,22 +136,22 @@ test('Source Node - sourceNode.makeRoot', function (t) { test('Source Node - sourceNode.setIdentifier', function (t) { const sourceNode = new FakeSourceNode({ asyncId: 2 }) - t.strictEqual( + t.equal( sourceNode.hash(), null ) - t.strictEqual( + t.equal( sourceNode.toJSON().identifier, null ) sourceNode.setIdentifier('string will be the id') - t.strictEqual( + t.equal( sourceNode.toJSON().identifier, 'string will be the id' ) - t.strictEqual( + t.equal( sourceNode.hash(), crypto.createHash('sha256').update('string will be the id').digest('hex') ) @@ -181,7 +181,7 @@ test('Source Node - sourceNode.addRawEvent', function (t) { ) const sourceNodeWithStackTraceExpected = new SourceNode(2) sourceNodeWithStackTraceExpected.addStackTrace(stackTraceObject) - t.strictDeepEqual( + t.strictSame( sourceNodeWithStackTrace, sourceNodeWithStackTraceExpected ) @@ -192,7 +192,7 @@ test('Source Node - sourceNode.addRawEvent', function (t) { ) const sourceNodeWithTraceEventExpected = new SourceNode(2) sourceNodeWithTraceEventExpected.addTraceEvent(traceEventObject) - t.strictDeepEqual( + t.strictSame( sourceNodeWithTraceEvent, sourceNodeWithTraceEventExpected ) @@ -225,7 +225,7 @@ test('Source Node - sourceNode.addStackTrace', function (t) { const sourceNode = new SourceNode(2) sourceNode.addStackTrace(stackTraceObject) - t.strictEqual(sourceNode.frames, stackTraceObject.frames) + t.equal(sourceNode.frames, stackTraceObject.frames) const sourceNodeNodeStackTrace = new SourceNode(2) t.throws( @@ -288,7 +288,7 @@ test('Source Node - sourceNode.addTraceEvent', function (t) { sourceNode.addTraceEvent(traceEventAfterObject) sourceNode.addTraceEvent(traceEventDestroyObject) - t.strictDeepEqual(sourceNode.toJSON(), { + t.strictSame(sourceNode.toJSON(), { asyncId: 2, frames: null, type: 'CUSTOM', @@ -386,11 +386,11 @@ test('Source Node - sourceNode.isComplete', function (t) { destroy: 6 }) - t.strictEqual(sourceNodeNoFrames.isComplete(), false) - t.strictEqual(sourceNodeNoInit.isComplete(), false) - t.strictEqual(sourceNodeNoDestroy.isComplete(), false) - t.strictEqual(sourceNodeUnmatchingBeforeAndAfter.isComplete(), false) - t.strictEqual(sourceNodeComplete.isComplete(), true) + t.equal(sourceNodeNoFrames.isComplete(), false) + t.equal(sourceNodeNoInit.isComplete(), false) + t.equal(sourceNodeNoDestroy.isComplete(), false) + t.equal(sourceNodeUnmatchingBeforeAndAfter.isComplete(), false) + t.equal(sourceNodeComplete.isComplete(), true) t.end() }) @@ -417,7 +417,7 @@ test('Source Node - sourceNode.hasStackTrace', function (t) { init: 1 }) - t.strictEqual(sourceNodeNoFrames.hasStackTrace(), false) - t.strictEqual(sourceNodeWithFrames.hasStackTrace(), true) + t.equal(sourceNodeNoFrames.hasStackTrace(), false) + t.equal(sourceNodeWithFrames.hasStackTrace(), true) t.end() }) diff --git a/test/analysis-stack-trace-frames.test.js b/test/analysis-stack-trace-frames.test.js index d2bcc545..aa6d7e7e 100644 --- a/test/analysis-stack-trace-frames.test.js +++ b/test/analysis-stack-trace-frames.test.js @@ -48,7 +48,7 @@ test('Stack Trace - frame.toJSON', function (t) { const frames = new Frames(data) - t.strictDeepEqual( + t.strictSame( frames.map((frame) => frame.toJSON()), data ) @@ -77,7 +77,7 @@ test('Stack Trace - frame.isNodecore', function (t) { ]) const root = new FakeSystemInfo('/') - t.strictDeepEqual( + t.strictSame( frames.map((frame) => frame.isNodecore(root)), [true, true, false, false, false] ) @@ -114,12 +114,12 @@ test('Stack Trace - frame.isExternal', function (t) { const root = new FakeSystemInfo('/') const modules = new FakeSystemInfo('/node_modules/internal') - t.strictDeepEqual( + t.strictSame( frames.map((frame) => frame.isExternal(root)), [true, true, true, true, true, false, true] ) - t.strictDeepEqual( + t.strictSame( frames.map((frame) => frame.isExternal(modules)), [true, true, true, true, true, false, false] ) @@ -144,7 +144,7 @@ test('Stack Trace - frame.getModuleName', function (t) { ]) const root = new FakeSystemInfo('/') - t.strictDeepEqual( + t.strictSame( frames.map((frame) => frame.getModuleName(root)), [ null, { @@ -189,7 +189,7 @@ test('Stack Trace - frame.getPosition', function (t) { } ]) - t.strictDeepEqual( + t.strictSame( frames.map((frame) => frame.getPosition()), [ 'events.js:10:20', 'events.js:0:20', @@ -242,7 +242,7 @@ test('Stack Trace - frame.format', function (t) { } ]) - t.strictDeepEqual( + t.strictSame( frames.map((frame) => frame.format()), [ ' filename.js:2:1', 'typeName.functionName filename.js:2:1', @@ -266,15 +266,15 @@ test('Stack Trace - frame.inspect', function (t) { } ]).get(0) - t.strictEqual(util.inspect(frame, { + t.equal(util.inspect(frame, { depth: 0 }), '') - t.strictEqual(util.inspect(frame, { + t.equal(util.inspect(frame, { depth: null }), '') - t.strictEqual(util.inspect(frame, { + t.equal(util.inspect(frame, { depth: -1 }), '') @@ -297,7 +297,7 @@ test('Stack Trace - frames.formatPositionOnly', function (t) { } ]) - t.strictEqual( + t.equal( frames.formatPositionOnly(), 'fileName.js:10:20\n' + 'fileName.js:20:10' @@ -325,39 +325,39 @@ test('Stack Trace - frames.inspect', function (t) { } ]) - t.strictEqual(util.inspect(framesEmpty, { + t.equal(util.inspect(framesEmpty, { depth: 1 }), '') - t.strictEqual(util.inspect(framesEmpty, { + t.equal(util.inspect(framesEmpty, { depth: null }), '') - t.strictEqual(util.inspect(framesEmpty, { + t.equal(util.inspect(framesEmpty, { depth: 0 }), '') - t.strictEqual(util.inspect(framesEmpty, { + t.equal(util.inspect(framesEmpty, { depth: -1 }), '') - t.strictEqual(util.inspect(frames, { + t.equal(util.inspect(frames, { depth: 1 }), ',\n' + ' ]>') - t.strictEqual(util.inspect(frames, { + t.equal(util.inspect(frames, { depth: null }), ',\n' + ' ]>') - t.strictEqual(util.inspect(frames, { + t.equal(util.inspect(frames, { depth: 0 }), ', ]>') - t.strictEqual(util.inspect(frames, { + t.equal(util.inspect(frames, { depth: -1 }), '') @@ -383,7 +383,7 @@ test('Stack Trace - frames.toJSON', function (t) { ] const frames = new Frames(data) - t.strictDeepEqual(frames.toJSON(), data) + t.strictSame(frames.toJSON(), data) t.end() }) @@ -404,7 +404,7 @@ test('Stack Trace - frames.length', function (t) { columnNumber: 1 } ]) - t.strictEqual(frames.length, 2) + t.equal(frames.length, 2) t.end() }) @@ -428,11 +428,11 @@ test('Stack Trace - frames.forEach', function (t) { const calls = [] frames.forEach(function (frame, index) { - t.strictEqual(frame, frames.get(index)) + t.equal(frame, frames.get(index)) calls.push(index) }) - t.strictDeepEqual(calls, [0, 1]) + t.strictSame(calls, [0, 1]) t.end() }) @@ -454,7 +454,7 @@ test('Stack Trace - frames.map', function (t) { } ]) - t.strictDeepEqual(frames.map((frame) => frame.functionName), [ + t.strictSame(frames.map((frame) => frame.functionName), [ 'functionA', 'functionB' ]) @@ -488,7 +488,7 @@ test('Stack Trace - frames.filter', function (t) { columnNumber: 1 }]) - t.strictDeepEqual( + t.strictSame( frames.filter((frame) => frame.functionName === 'functionB'), expectedFrames ) @@ -513,11 +513,11 @@ test('Stack Trace - frames.every', function (t) { } ]) - t.strictEqual( + t.equal( frames.every((frame) => frame.fileName === 'filename.js'), true ) - t.strictEqual( + t.equal( frames.every((frame) => frame.functionName === 'functionB'), false ) @@ -542,11 +542,11 @@ test('Stack Trace - frames.some', function (t) { } ]) - t.strictEqual( + t.equal( frames.some((frame) => frame.isToplevel === false), false ) - t.strictEqual( + t.equal( frames.some((frame) => frame.functionName === 'functionB'), true ) @@ -571,7 +571,7 @@ test('Stack Trace - frames.first', function (t) { } ]) - t.strictEqual(frames.first(), frames.get(0)) + t.equal(frames.first(), frames.get(0)) t.end() }) @@ -593,7 +593,7 @@ test('Stack Trace - frames.last', function (t) { } ]) - t.strictEqual(frames.last(), frames.get(1)) + t.equal(frames.last(), frames.get(1)) t.end() }) @@ -616,8 +616,8 @@ test('Stack Trace - frames.get', function (t) { ] const frames = new Frames(data) - t.strictDeepEqual(frames.get(0).toJSON(), data[0]) - t.strictDeepEqual(frames.get(1).toJSON(), data[1]) + t.strictSame(frames.get(0).toJSON(), data[0]) + t.strictSame(frames.get(1).toJSON(), data[1]) t.throws( () => frames.get(2), diff --git a/test/analysis-stack-trace.test.js b/test/analysis-stack-trace.test.js index 83ea7ec8..41fa4633 100644 --- a/test/analysis-stack-trace.test.js +++ b/test/analysis-stack-trace.test.js @@ -18,14 +18,14 @@ test('Stack Trace - stream wrap', function (t) { startpoint(input, { objectMode: true }) .pipe(new WrapAsStackTrace()) .pipe(endpoint({ objectMode: true }, function (err, output) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.strictDeepEqual( + t.strictSame( output, input.map((data) => new StackTrace(data)) ) - t.strictDeepEqual( + t.strictSame( output.map((data) => data.frames), input.map((data) => new Frames(data.frames)) ) @@ -41,6 +41,6 @@ test('Stack Trace - toJSON', function (t) { }] } - t.strictDeepEqual(new StackTrace(input).toJSON(), input) + t.strictSame(new StackTrace(input).toJSON(), input) t.end() }) diff --git a/test/analysis-system-info.test.js b/test/analysis-system-info.test.js index 22c6065e..34c01754 100644 --- a/test/analysis-system-info.test.js +++ b/test/analysis-system-info.test.js @@ -9,10 +9,10 @@ test('Stack Trace - isExternal', function (t) { const modulesDeep = new FakeSystemInfo('/node_modules/internal/deep') const modulesPrivate = new FakeSystemInfo('/node_modules/@private/internal') - t.strictEqual(root.moduleDirectory, '') - t.strictEqual(modules.moduleDirectory, '/node_modules/internal') - t.strictEqual(modulesDeep.moduleDirectory, '/node_modules/internal') - t.strictEqual(modulesPrivate.moduleDirectory, + t.equal(root.moduleDirectory, '') + t.equal(modules.moduleDirectory, '/node_modules/internal') + t.equal(modulesDeep.moduleDirectory, '/node_modules/internal') + t.equal(modulesPrivate.moduleDirectory, '/node_modules/@private/internal') t.end() diff --git a/test/analysis-trace-event.test.js b/test/analysis-trace-event.test.js index d5c4a6a1..a78b2f63 100644 --- a/test/analysis-trace-event.test.js +++ b/test/analysis-trace-event.test.js @@ -19,9 +19,9 @@ test('Trace Event - stream wrap', function (t) { startpoint(input, { objectMode: true }) .pipe(new WrapAsTraceEvent()) .pipe(endpoint({ objectMode: true }, function (err, output) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.strictDeepEqual( + t.strictSame( output, input.map((data) => new TraceEvent(data)) ) @@ -40,6 +40,6 @@ test('Trace Event - toJSON', function (t) { executionAsyncId: 0 } - t.strictDeepEqual(new TraceEvent(input).toJSON(), input) + t.strictSame(new TraceEvent(input).toJSON(), input) t.end() }) diff --git a/test/analysis.test.js b/test/analysis.test.js index 021f5211..5d073dc3 100644 --- a/test/analysis.test.js +++ b/test/analysis.test.js @@ -182,10 +182,10 @@ test('Analysis - pipeline', function (t) { analysis(systemInfo, stackTrace, traceEvent) .pipe(endpoint({ objectMode: true }, function (err, output) { - if (err) return t.ifError(err) + if (err) return t.error(err) - t.strictDeepEqual(output[0].toJSON(), clusterNodeRoot.toJSON()) - t.strictDeepEqual(output[1].toJSON(), clusterNodeExternal.toJSON()) + t.strictSame(output[0].toJSON(), clusterNodeRoot.toJSON()) + t.strictSame(output[1].toJSON(), clusterNodeExternal.toJSON()) t.end() })) @@ -197,7 +197,7 @@ test('Analysis - pipeline with SystemInfo error', function (t) { analysis(systemInfo, stackTrace, traceEvent) .pipe(endpoint({ objectMode: true }, function (err, output) { - t.strictDeepEqual(err, new Error('error')) + t.strictSame(err, new Error('error')) t.end() })) }) diff --git a/test/cmd-collect-analysing.test.js b/test/cmd-collect-analysing.test.js index 8fae675c..ad184821 100644 --- a/test/cmd-collect-analysing.test.js +++ b/test/cmd-collect-analysing.test.js @@ -8,10 +8,10 @@ test('test collect - emits "analysing" event', function (t) { const tool = new ClinicBubbleprof() function cleanup (err, dirname) { - t.ifError(err) + t.error(err) t.match(dirname, /^[0-9]+\.clinic-bubbleprof$/) rimraf(dirname, (err) => { - t.ifError(err) + t.error(err) t.end() }) } diff --git a/test/cmd-collect-detect-port.test.js b/test/cmd-collect-detect-port.test.js index 22a377f8..21336aca 100644 --- a/test/cmd-collect-detect-port.test.js +++ b/test/cmd-collect-detect-port.test.js @@ -23,7 +23,7 @@ test('cmd - collect - detect server port', function (t) { const buf = [] res.on('data', data => buf.push(data)) res.on('end', function () { - t.deepEquals(Buffer.concat(buf), Buffer.from('from server')) + t.same(Buffer.concat(buf), Buffer.from('from server')) t.end() }) }) diff --git a/test/cmd-collect-exit.test.js b/test/cmd-collect-exit.test.js index 59b12fce..f9e4e44e 100644 --- a/test/cmd-collect-exit.test.js +++ b/test/cmd-collect-exit.test.js @@ -22,11 +22,11 @@ testNotWindows('cmd - collect - external SIGINT is relayed', function (t) { stdout (done) { child.stdout.pipe(endpoint(done)) }, stderr (done) { child.stderr.pipe(endpoint(done)) } }, function (err, output) { - if (err) return t.ifError(err) + if (err) return t.error(err) // Expect the WARNING output to be shown t.ok(output.stderr.toString().split('\n').length, 1) - t.strictEqual(output.stdout.toString(), + t.equal(output.stdout.toString(), 'listening for SIGINT\nSIGINT received\n') t.end() }) @@ -34,7 +34,7 @@ testNotWindows('cmd - collect - external SIGINT is relayed', function (t) { test('cmd - collect - non-success exit code should not throw', function (t) { const cmd = new CollectAndRead({}, '--expose-gc', '-e', 'process.exit(1)') - cmd.on('error', t.ifError.bind(t)) + cmd.on('error', t.error.bind(t)) cmd.on('ready', function () { t.end() }) diff --git a/test/cmd-collect-node-options-env.test.js b/test/cmd-collect-node-options-env.test.js index fcb54db3..d6d73241 100644 --- a/test/cmd-collect-node-options-env.test.js +++ b/test/cmd-collect-node-options-env.test.js @@ -22,11 +22,11 @@ test('cmd - collect - NODE_OPTIONS environment is not ignored', function (t) { stdout (done) { child.stdout.pipe(endpoint(done)) }, stderr (done) { child.stderr.pipe(endpoint(done)) } }, function (err, output) { - if (err) return t.ifError(err) + if (err) return t.error(err) // Expect the WARNING output to be shown t.ok(output.stderr.toString().split('\n').length, 1) - t.strictEqual(output.stdout.toString().trim(), '4013') + t.equal(output.stdout.toString().trim(), '4013') t.end() }) }) diff --git a/test/cmd-collect.test.js b/test/cmd-collect.test.js index 2553e391..ec6fb8d7 100644 --- a/test/cmd-collect.test.js +++ b/test/cmd-collect.test.js @@ -8,7 +8,7 @@ const CollectAndRead = require('./collect-and-read.js') test('collect command produces data files with content', function (t) { const cmd = new CollectAndRead({}, '-e', 'setTimeout(() => {}, 200)') - cmd.on('error', t.ifError.bind(t)) + cmd.on('error', t.error.bind(t)) cmd.on('ready', function (systemInfoReader, stackTraceReader, traceEventReader) { async.parallel({ systemInfo (done) { @@ -54,7 +54,7 @@ test('collect command produces data files with content', function (t) { })) } }, function (err, output) { - if (err) return t.ifError(err) + if (err) return t.error(err) // filter untracked events out for (const asyncId of output.traceEvent.keys()) { @@ -64,7 +64,7 @@ test('collect command produces data files with content', function (t) { } // Expect all tracked asyncIds to be found in traceEvent - t.strictDeepEqual( + t.strictSame( Array.from(output.stackTrace.keys()).sort(), Array.from(output.traceEvent.keys()).sort() ) @@ -75,17 +75,17 @@ test('collect command produces data files with content', function (t) { asyncOperationTypes.push(trackedTraceEvent[0].type) } - const expected = - // Expect Timeout and TIMERWRAP to be there in Node 10.x and below. TIMERWRAP was removed in https://github.com/nodejs/node/pull/20894 - semver.satisfies(process.version, '< 11.0') - ? ['TIMERWRAP', 'Timeout'] + let expected = ['Timeout'] + if (semver.satisfies(process.version, '>= 12.16.0 < 12.17.0')) { // A `Promise.resolve()` call was added to bootstrap code in Node 12.16.x: https://github.com/nodejs/node/pull/30624 // Node.js 12.17.0 does not appear to show this `resolve()` call in its trace event log. - : semver.satisfies(process.version, '>= 12.16.0 < 12.17.0') - ? ['PROMISE', 'Timeout'] - : ['Timeout'] + expected = ['PROMISE', 'Timeout'] + } else if (semver.satisfies(process.version, '>= 15.0.0')) { + // See: https://github.com/clinicjs/node-clinic-bubbleprof/pull/382#issuecomment-962766194 + expected = ['TickObject', 'Timeout'] + } - t.strictDeepEqual(asyncOperationTypes.sort(), expected) + t.strictSame(asyncOperationTypes.sort(), expected) t.end() }) diff --git a/test/cmd-dest.test.js b/test/cmd-dest.test.js index e260b718..58d6cd70 100644 --- a/test/cmd-dest.test.js +++ b/test/cmd-dest.test.js @@ -7,11 +7,11 @@ test('cmd - test collect - custom output destination', (t) => { const tool = new ClinicBubbleprof({ debug: true, dest: 'test-output-destination' }) function cleanup (err, dirname) { - t.ifError(err) + t.error(err) t.match(dirname, /^test-output-destination[/\\][0-9]+\.clinic-bubbleprof$/) rimraf('test-output-destination', (err) => { - t.ifError(err) + t.error(err) t.end() }) } diff --git a/test/cmd-no-cluster.test.js b/test/cmd-no-cluster.test.js index 4aa11b73..47c1a730 100644 --- a/test/cmd-no-cluster.test.js +++ b/test/cmd-no-cluster.test.js @@ -11,7 +11,7 @@ test('collect command stops when cluster is used', function (t) { const bubble = new ClinicBubbleprof({}) bubble.collect([process.execPath, '-e', 'require("cluster")'], (err, result) => { - t.ifError(err, 'should not crash when cluster is required but not used') + t.error(err, 'should not crash when cluster is required but not used') rimraf.sync(result) }) @@ -20,7 +20,7 @@ test('collect command stops when cluster is used', function (t) { ], { stdio: 'pipe' }) proc.stderr.pipe(endpoint((err, buf) => { - t.ifError(err) + t.error(err) t.ok(buf.toString('utf8').includes('does not support clustering'), 'should crash once cluster is used') })) }) diff --git a/test/cmd-visualize.test.js b/test/cmd-visualize.test.js index b5481260..cbdb08d6 100644 --- a/test/cmd-visualize.test.js +++ b/test/cmd-visualize.test.js @@ -10,13 +10,13 @@ test('cmd - test visualization', function (t) { const tool = new ClinicBubbleprof() function cleanup (err, dirname) { - t.ifError(err) + t.error(err) async.parallel([ (done) => rimraf(dirname, done), (done) => fs.unlink(dirname + '.html', done) ], function (err) { - t.ifError(err) + t.error(err) t.end() }) } diff --git a/test/collect-get-logging-paths.test.js b/test/collect-get-logging-paths.test.js index 9e7c2e8f..a258f00f 100644 --- a/test/collect-get-logging-paths.test.js +++ b/test/collect-get-logging-paths.test.js @@ -7,7 +7,7 @@ const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('bubb test('Collect - logging path - identifier', function (t) { const paths = getLoggingPaths({ identifier: 1062 }) - t.strictDeepEqual(paths, { + t.strictSame(paths, { '/': '1062.clinic-bubbleprof', '/systeminfo': path.normalize('1062.clinic-bubbleprof/1062.clinic-bubbleprof-systeminfo'), '/stacktrace': path.normalize('1062.clinic-bubbleprof/1062.clinic-bubbleprof-stacktrace'), @@ -19,7 +19,7 @@ test('Collect - logging path - identifier', function (t) { test('Collect - logging path - path', function (t) { const paths = getLoggingPaths({ path: path.normalize('/root/1062.clinic-bubbleprof') }) - t.strictDeepEqual(paths, { + t.strictSame(paths, { '/': path.normalize('/root/1062.clinic-bubbleprof'), '/systeminfo': path.normalize('/root/1062.clinic-bubbleprof/1062.clinic-bubbleprof-systeminfo'), '/stacktrace': path.normalize('/root/1062.clinic-bubbleprof/1062.clinic-bubbleprof-stacktrace'), diff --git a/test/collect-stack-trace.test.js b/test/collect-stack-trace.test.js index 4fb38253..f97158aa 100644 --- a/test/collect-stack-trace.test.js +++ b/test/collect-stack-trace.test.js @@ -12,7 +12,7 @@ test('stack trace - function scope', function (t) { frames = stackTrace() })() - t.strictDeepEqual(Object.assign({}, frames[0]), { + t.strictSame(Object.assign({}, frames[0]), { functionName: 'functionScope', typeName: '', isEval: false, @@ -37,7 +37,7 @@ test('stack trace - method', function (t) { const type = new Type() const frames = type.method() - t.strictDeepEqual(Object.assign({}, frames[0]), { + t.strictSame(Object.assign({}, frames[0]), { functionName: 'method', typeName: 'Type', isEval: false, @@ -61,7 +61,7 @@ test('stack trace - constructor', function (t) { } const frames = (new Type()).frames - t.strictDeepEqual(Object.assign({}, frames[0]), { + t.strictSame(Object.assign({}, frames[0]), { functionName: 'Type', typeName: '', isEval: false, @@ -80,7 +80,7 @@ test('stack trace - constructor', function (t) { test('stack trace - eval', function (t) { const frames = eval('stackTrace()') // eslint-disable-line no-eval - t.strictDeepEqual(Object.assign({}, frames[0]), { + t.strictSame(Object.assign({}, frames[0]), { functionName: 'eval', typeName: '', isEval: true, @@ -134,7 +134,7 @@ test('stack trace - native', function (t) { columnNumber: 1 } - t.strictDeepEqual( + t.strictSame( Object.assign({}, frames[1]), isTorqueSortVersion ? expectedTorque : expectedNative ) diff --git a/test/format-stack-trace.test.js b/test/format-stack-trace.test.js index a9a04949..c3dbb48e 100644 --- a/test/format-stack-trace.test.js +++ b/test/format-stack-trace.test.js @@ -36,7 +36,7 @@ test('format - stack trace - basic encoder-decoder works', function (t) { } decoder.once('end', function () { - t.strictDeepEqual(input, output) + t.strictSame(input, output) t.end() }) @@ -70,42 +70,42 @@ test('format - stack trace - partial decoding', function (t) { // partial message length decoder.write(example1Encoded.slice(0, 1)) - t.strictEqual(decoder.read(), null) + t.equal(decoder.read(), null) // message length complete, partial message decoder.write(example1Encoded.slice(1, 20)) - t.strictEqual(decoder.read(), null) + t.equal(decoder.read(), null) // message complete, next message incomplete decoder.write(Buffer.concat([ example1Encoded.slice(20), example2Encoded.slice(0, 30) ])) - t.strictDeepEqual(decoder.read(), example1) - t.strictEqual(decoder.read(), null) + t.strictSame(decoder.read(), example1) + t.equal(decoder.read(), null) // ended previuse sample, but a partial remains decoder.write(Buffer.concat([ example2Encoded.slice(30), example3Encoded.slice(0, 40) ])) - t.strictDeepEqual(decoder.read(), example2) - t.strictEqual(decoder.read(), null) + t.strictSame(decoder.read(), example2) + t.equal(decoder.read(), null) // Ended previuse, no partial remains decoder.write(Buffer.concat([ example3Encoded.slice(40), example4Encoded ])) - t.strictDeepEqual(decoder.read(), example3) - t.strictDeepEqual(decoder.read(), example4) - t.strictEqual(decoder.read(), null) + t.strictSame(decoder.read(), example3) + t.strictSame(decoder.read(), example4) + t.equal(decoder.read(), null) // No previuse ended decoder.write(example5Encoded) - t.strictDeepEqual(decoder.read(), example5) + t.strictSame(decoder.read(), example5) // No more data - t.strictEqual(decoder.read(), null) + t.equal(decoder.read(), null) t.end() }) diff --git a/test/format-trace-events.test.js b/test/format-trace-events.test.js index b1273f9e..6e6c03e0 100644 --- a/test/format-trace-events.test.js +++ b/test/format-trace-events.test.js @@ -54,12 +54,12 @@ test('format - trace event - decoder', function (t) { })) decoder.pipe(endpoint({ objectMode: true }, function (err, data) { - if (err) return t.ifError(err) + if (err) return t.error(err) // Remove prototype constructor const traceEvent = data.map((v) => Object.assign({}, v)) - t.strictDeepEqual(traceEvent, [{ + t.strictSame(traceEvent, [{ event: 'init', type: 'TYPENAME', asyncId: 2, diff --git a/test/integration-servers.test.js b/test/integration-servers.test.js index e3b4bab7..6a7d0641 100644 --- a/test/integration-servers.test.js +++ b/test/integration-servers.test.js @@ -37,7 +37,7 @@ function runServer (name, callback) { test('basic server aggregates HTTPPARSER', { skip: skipHTTPPARSER }, function (t) { runServer('basic', function (err, nodes) { - if (err) return t.ifError(err) + if (err) return t.error(err) // Get AggregateNodes from BarrierNodes const aggregateNodes = [].concat( @@ -51,14 +51,14 @@ test('basic server aggregates HTTPPARSER', { skip: skipHTTPPARSER }, function (t // HTTPPARSER can have different stacks, because it was either new or // a cached HTTPPARSER. Check that these two cases are aggregated into // one node. - t.strictEqual(httpParserNodes.length, 1) + t.equal(httpParserNodes.length, 1) t.end() }) }) test('latency server has http.connection.end cluster', { skip: skipHTTPPARSER }, function (t) { runServer('latency', function (err, nodes) { - if (err) return t.ifError(err) + if (err) return t.error(err) const endName = nodes.some(c => c.name.includes('http.connection.end')) t.ok(endName, 'has http.connection.end name') diff --git a/test/integration-timeout.test.js b/test/integration-timeout.test.js index 5ee51d85..e8f64e18 100644 --- a/test/integration-timeout.test.js +++ b/test/integration-timeout.test.js @@ -8,11 +8,11 @@ const analysis = require('../analysis/index.js') test('collect-analysis pipeline', function (t) { const cmd = new CollectAndRead({}, '-e', 'setTimeout(() => {}, 200)') - cmd.on('error', t.ifError.bind(t)) + cmd.on('error', t.error.bind(t)) cmd.on('ready', function (systemInfoReader, stackTraceReader, traceEventReader) { analysis(systemInfoReader, stackTraceReader, traceEventReader) .pipe(endpoint({ objectMode: true }, function (err, nodes) { - if (err) return t.ifError(err) + if (err) return t.error(err) // Get AggregateNodes from BarrierNodes const aggregateNodes = [].concat( @@ -23,19 +23,19 @@ test('collect-analysis pipeline', function (t) { aggregateNodes.map((node) => [node.aggregateId, node]) ) if (semver.satisfies(process.version, '>= 12.16.0 < 12.17.0')) { - t.strictEqual(nodes.length, 3) - t.strictEqual(nodeMap.size, 3) + t.equal(nodes.length, 3) + t.equal(nodeMap.size, 3) // aggregateId = 1 is the root and points to the Timeout and a PROMISE from Node.js's initialization code - t.strictDeepEqual(nodeMap.get(1).children, [2, 3]) + t.strictSame(nodeMap.get(1).children, [2, 3]) } else { - t.strictEqual(nodes.length, 2) - t.strictEqual(nodeMap.size, 2) + t.equal(nodes.length, 2) + t.equal(nodeMap.size, 2) // aggregateId = 1 is the root and points to the Timeout - t.strictDeepEqual(nodeMap.get(1).children, [2]) + t.strictSame(nodeMap.get(1).children, [2]) } // aggregateId = 2 is the Timeout - t.strictEqual(nodeMap.get(2).sources[0].type, 'Timeout') + t.equal(nodeMap.get(2).sources[0].type, 'Timeout') t.end() })) diff --git a/test/visualizer-data-callback-event.test.js b/test/visualizer-data-callback-event.test.js index c8911605..a84e4c6d 100644 --- a/test/visualizer-data-callback-event.test.js +++ b/test/visualizer-data-callback-event.test.js @@ -65,7 +65,7 @@ test('Visualizer data - CallbackEvents - ClusterNode stats from CallbackEvents', } errorMessage = errorMessage || 'Pass' - t.equals(errorMessage, 'Pass') + t.equal(errorMessage, 'Pass') t.end() }) @@ -87,7 +87,7 @@ test('Visualizer data - CallbackEvents - AggregateNode stats from CallbackEvents } } errorMessage = errorMessage || 'Pass' - t.equals(errorMessage, 'Pass') + t.equal(errorMessage, 'Pass') t.end() }) @@ -107,18 +107,18 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { const wallTime = dataSet.wallTime // Ensure essential stats from fake data set are calculated correctly from callback events - t.equals(wallTime.profileStart, 3) - t.equals(wallTime.profileEnd, 29.5) - t.equals(wallTime.profileDuration, 26.5) - t.equals(wallTime.msPerSlice, 0.265) + t.equal(wallTime.profileStart, 3) + t.equal(wallTime.profileEnd, 29.5) + t.equal(wallTime.profileDuration, 26.5) + t.equal(wallTime.msPerSlice, 0.265) - t.equals(wallTime.maxAsyncPending, 5) - t.equals(wallTime.maxSyncActive, 3) + t.equal(wallTime.maxAsyncPending, 5) + t.equal(wallTime.maxSyncActive, 3) t.strictSame(wallTime.categoriesOrdered, ['other', 'networks', 'files-streams']) // Simple slice containing two instances of one aggregate node const sliceA = wallTime.getSegments(10, 11) - t.equals(sliceA.length, 5) + t.equal(sliceA.length, 5) const expected = { syncIds: {}, @@ -132,16 +132,16 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { syncActive } = sliceA[i] - t.equals(syncActive.callbackCount, 0) + t.equal(syncActive.callbackCount, 0) t.strictSame(syncActive.byAggregateId, expected.syncIds) - t.equals(asyncPending.callbackCount, 2) + t.equal(asyncPending.callbackCount, 2) t.strictSame(asyncPending.byAggregateId, expected.asyncAggregateIds) } // More complex slice const sliceB = wallTime.getSegments(22.5, 25) - t.equals(sliceB.length, 11) + t.equal(sliceB.length, 11) for (i = 0; i < sliceB.length; i++) { const { @@ -156,7 +156,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { case 3: // 23.055 - 23.32 wallTime.getSegments(22.26, 23.32, true).forEach((segment) => t.strictSame(segment, sliceB[i])) - t.equals(syncActive.callbackCount, 1) + t.equal(syncActive.callbackCount, 1) t.strictSame(syncActive.byAggregateId, { d: 1 }) @@ -164,7 +164,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { other: 1 }) - t.equals(asyncPending.callbackCount, 2) + t.equal(asyncPending.callbackCount, 2) t.strictSame(asyncPending.byAggregateId, { e: 1, f: 1 @@ -177,7 +177,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { case 4: // 23.32 - 23.585 wallTime.getSegments(23.4, 23.585, true).forEach((segment) => t.strictSame(segment, sliceB[i])) - t.equals(syncActive.callbackCount, 1) + t.equal(syncActive.callbackCount, 1) t.strictSame(syncActive.byAggregateId, { d: 1 }) @@ -185,7 +185,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { other: 1 }) - t.equals(asyncPending.callbackCount, 4) + t.equal(asyncPending.callbackCount, 4) t.strictSame(asyncPending.byAggregateId, { d: 1, e: 2, @@ -199,11 +199,11 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { case 5: // 23.585 - 23.85 wallTime.getSegments(23.585, 23.85, true).forEach((segment) => t.strictSame(segment, sliceB[i])) - t.equals(syncActive.callbackCount, 0) + t.equal(syncActive.callbackCount, 0) t.strictSame(syncActive.byAggregateId, {}) t.strictSame(syncActive.byTypeCategory, {}) - t.equals(asyncPending.callbackCount, 4) + t.equal(asyncPending.callbackCount, 4) t.strictSame(asyncPending.byAggregateId, { d: 1, e: 2, @@ -217,7 +217,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { case 6: // 23.85 - 24.115 wallTime.getSegments(23.85, 24.115, true).forEach((segment) => t.strictSame(segment, sliceB[i])) - t.equals(syncActive.callbackCount, 2) + t.equal(syncActive.callbackCount, 2) t.strictSame(syncActive.byAggregateId, { e: 2 }) @@ -225,7 +225,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { other: 2 }) - t.equals(asyncPending.callbackCount, 4) + t.equal(asyncPending.callbackCount, 4) t.strictSame(asyncPending.byAggregateId, { d: 1, e: 2, @@ -239,7 +239,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { case 7: // 24.115 - 24.38 wallTime.getSegments(24.115, 24.38, true).forEach((segment) => t.strictSame(segment, sliceB[i])) - t.equals(syncActive.callbackCount, 2) + t.equal(syncActive.callbackCount, 2) t.strictSame(syncActive.byAggregateId, { e: 2 }) @@ -247,7 +247,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { other: 2 }) - t.equals(asyncPending.callbackCount, 2) + t.equal(asyncPending.callbackCount, 2) t.strictSame(asyncPending.byAggregateId, { d: 1, f: 1 @@ -260,7 +260,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { case 8: // 24.38 - 24.645 wallTime.getSegments(24.38, 24.645, true).forEach((segment) => t.strictSame(segment, sliceB[i])) - t.equals(syncActive.callbackCount, 2) + t.equal(syncActive.callbackCount, 2) t.strictSame(syncActive.byAggregateId, { e: 2 }) @@ -268,7 +268,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { other: 2 }) - t.equals(asyncPending.callbackCount, 4) + t.equal(asyncPending.callbackCount, 4) t.strictSame(asyncPending.byAggregateId, { d: 1, e: 1, @@ -283,7 +283,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { case 9: // 24.645 - 24.91 wallTime.getSegments(24.645, 24.91, true).forEach((segment) => t.strictSame(segment, sliceB[i])) - t.equals(syncActive.callbackCount, 1) + t.equal(syncActive.callbackCount, 1) t.strictSame(syncActive.byAggregateId, { e: 1 }) @@ -291,7 +291,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { other: 1 }) - t.equals(asyncPending.callbackCount, 4) + t.equal(asyncPending.callbackCount, 4) t.strictSame(asyncPending.byAggregateId, { d: 1, e: 1, @@ -306,7 +306,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { case 10: // 24.91 - 25.175 wallTime.getSegments(24.91, 25.175, true).forEach((segment) => t.strictSame(segment, sliceB[i])) - t.equals(syncActive.callbackCount, 3) + t.equal(syncActive.callbackCount, 3) t.strictSame(syncActive.byAggregateId, { d: 1, e: 2 @@ -315,7 +315,7 @@ test('Visualizer data - CallbackEvents - Wall time slices', function (t) { other: 3 }) - t.equals(asyncPending.callbackCount, 5) + t.equal(asyncPending.callbackCount, 5) t.strictSame(asyncPending.byAggregateId, { d: 1, e: 1, diff --git a/test/visualizer-data-dataset.test.js b/test/visualizer-data-dataset.test.js index d5dbd8a0..adc59cbc 100644 --- a/test/visualizer-data-dataset.test.js +++ b/test/visualizer-data-dataset.test.js @@ -11,9 +11,9 @@ function round4dp (num) { test('Visualizer dataset - fake json', function (t) { const dataSet = loadData({ debugMode: true }, fakeJson) - t.equals(dataSet.clusterNodes.size, 2) - t.equals(dataSet.aggregateNodes.size, 2) - t.equals(dataSet.sourceNodes.length, 2) + t.equal(dataSet.clusterNodes.size, 2) + t.equal(dataSet.aggregateNodes.size, 2) + t.equal(dataSet.sourceNodes.length, 2) t.end() }) @@ -47,11 +47,11 @@ test('Visualizer dataset - wallTime from real sample data', function (t) { const dataSet = new DataSet(acmeairJson, { wallTimeSlices: 100 }) // Ensure stats calculated from real profile data subset don't changed from unexpected future feature side effects - t.equals(dataSet.wallTime.profileStart, 6783474.641) - t.equals(dataSet.wallTime.profileEnd, 6786498.31) + t.equal(dataSet.wallTime.profileStart, 6783474.641) + t.equal(dataSet.wallTime.profileEnd, 6786498.31) dataSet.processData() - t.equals(round4dp(dataSet.wallTime.profileDuration), 3023.6690) - t.equals(round4dp(dataSet.wallTime.msPerSlice), 30.2367) + t.equal(round4dp(dataSet.wallTime.profileDuration), 3023.6690) + t.equal(round4dp(dataSet.wallTime.msPerSlice), 30.2367) // todo - unify variable and class names with UI labels const typeDecimals = [ @@ -61,13 +61,13 @@ test('Visualizer dataset - wallTime from real sample data', function (t) { dataSet.getDecimal('typeCategory', 'timing-promises'), dataSet.getDecimal('typeCategory', 'other') ] - t.equals(round4dp(typeDecimals[0]), 0.8461) - t.equals(round4dp(typeDecimals[1]), 0.0017) - t.equals(round4dp(typeDecimals[2]), 0) - t.equals(round4dp(typeDecimals[3]), 0.1521) - t.equals(round4dp(typeDecimals[4]), 0) - t.equals(round4dp(typeDecimals.reduce((accum, num) => accum + num, 0)), 1) - t.equals(dataSet.decimals.typeCategory.size, 5) + t.equal(round4dp(typeDecimals[0]), 0.8461) + t.equal(round4dp(typeDecimals[1]), 0.0017) + t.equal(round4dp(typeDecimals[2]), 0) + t.equal(round4dp(typeDecimals[3]), 0.1521) + t.equal(round4dp(typeDecimals[4]), 0) + t.equal(round4dp(typeDecimals.reduce((accum, num) => accum + num, 0)), 1) + t.equal(dataSet.decimals.typeCategory.size, 5) const partyDecimals = [ dataSet.getDecimal('party', 'user'), @@ -75,15 +75,15 @@ test('Visualizer dataset - wallTime from real sample data', function (t) { dataSet.getDecimal('party', 'nodecore'), dataSet.getDecimal('party', 'root') ] - t.equals(round4dp(partyDecimals[0]), 0.2968) - t.equals(round4dp(partyDecimals[1]), 0.6829) - t.equals(round4dp(partyDecimals[2]), 0.0203) - t.equals(round4dp(partyDecimals[3]), 0) - t.equals(round4dp(partyDecimals.reduce((accum, num) => accum + num, 0)), 1) - t.equals(dataSet.decimals.party.size, 4) - - t.equals(dataSet.getDecimal('typeCategory', 'some-key-not-in-map'), null) - t.equals(dataSet.getDecimal('party', 'some-key-not-in-map'), null) + t.equal(round4dp(partyDecimals[0]), 0.2968) + t.equal(round4dp(partyDecimals[1]), 0.6829) + t.equal(round4dp(partyDecimals[2]), 0.0203) + t.equal(round4dp(partyDecimals[3]), 0) + t.equal(round4dp(partyDecimals.reduce((accum, num) => accum + num, 0)), 1) + t.equal(dataSet.decimals.party.size, 4) + + t.equal(dataSet.getDecimal('typeCategory', 'some-key-not-in-map'), null) + t.equal(dataSet.getDecimal('party', 'some-key-not-in-map'), null) t.end() }) diff --git a/test/visualizer-data-node.test.js b/test/visualizer-data-node.test.js index 84302f73..f73e4b68 100644 --- a/test/visualizer-data-node.test.js +++ b/test/visualizer-data-node.test.js @@ -57,8 +57,8 @@ function validateData (dataSet) { test('Visualizer data - data nodes - examples/slow-io sample json', function (t) { const dataSet = loadData({ debugMode: true }, slowioJson) - t.equals(dataSet.clusterNodes.size, 33) - t.equals(validateData(dataSet), 'Pass') + t.equal(dataSet.clusterNodes.size, 33) + t.equal(validateData(dataSet), 'Pass') t.end() }) @@ -66,10 +66,10 @@ test('Visualizer data - data nodes - examples/slow-io sample json', function (t) test('Visualizer data - data nodes - acmeair sample json', function (t) { const dataSet = loadData({ debugMode: true, averaging: 'median' }, acmeairJson) - t.equals(dataSet.settings.averaging, 'median') + t.equal(dataSet.settings.averaging, 'median') - t.equals(dataSet.clusterNodes.size, 24) - t.equals(validateData(dataSet), 'Pass') + t.equal(dataSet.clusterNodes.size, 24) + t.equal(validateData(dataSet), 'Pass') t.end() }) @@ -155,8 +155,8 @@ test('Visualizer data - data nodes - set invalid stat', function (t) { clusterNode.validateStat(Infinity, '') }, new Error('For ClusterNode A: Got Infinity, must be finite')) - t.equals(clusterNode.validateStat(0, ''), 0) - t.equals(clusterNode.validateStat(Infinity, '', { isFinite: false }), Infinity) + t.equal(clusterNode.validateStat(0, ''), 0) + t.equal(clusterNode.validateStat(Infinity, '', { isFinite: false }), Infinity) t.end() }) diff --git a/test/visualizer-layout-layer.test.js b/test/visualizer-layout-layer.test.js index e2f4e7ea..3247832a 100644 --- a/test/visualizer-layout-layer.test.js +++ b/test/visualizer-layout-layer.test.js @@ -22,8 +22,8 @@ const lineExtras = (layoutSettings.lineWidth + layoutSettings.labelMinimumSpace test('Visualizer - layer - dataset is healthy', function (t) { const dataSet = new DataSet({ data: clusterNodesArray }) - t.deepEqual([...dataSet.clusterNodes.keys()].sort(), clusterNodesArray.map(node => node.id).sort()) - t.deepEqual([...dataSet.aggregateNodes.keys()].sort(), aggregateNodesArray.map(node => node.id).sort()) + t.same([...dataSet.clusterNodes.keys()].sort(), clusterNodesArray.map(node => node.id).sort()) + t.same([...dataSet.aggregateNodes.keys()].sort(), aggregateNodesArray.map(node => node.id).sort()) dataSet.processData() @@ -54,20 +54,20 @@ test('Visualizer - layer - layout is healthy on init', function (t) { const layout = new Layout({ dataNodes: [...dataSet.clusterNodes.values()] }, layoutSettings) // Ensure custom settings get applied over defaults as expected - t.deepEqual(layout.settings, Object.assign({}, layout.settings, layoutSettings)) + t.same(layout.settings, Object.assign({}, layout.settings, layoutSettings)) t.equal(layout.layoutNodes.get('A').parent, null) - t.deepEqual(layout.layoutNodes.get('A').children, ['B', 'C']) + t.same(layout.layoutNodes.get('A').children, ['B', 'C']) t.equal(layout.layoutNodes.get('B').parent.id, layout.layoutNodes.get('A').id) t.equal(layout.layoutNodes.get('C').parent.id, layout.layoutNodes.get('A').id) - t.deepEqual(layout.layoutNodes.get('B').children, ['D', 'E']) + t.same(layout.layoutNodes.get('B').children, ['D', 'E']) t.equal(layout.layoutNodes.get('D').parent.id, layout.layoutNodes.get('B').id) t.equal(layout.layoutNodes.get('E').parent.id, layout.layoutNodes.get('B').id) - t.deepEqual(layout.layoutNodes.get('C').children, []) - t.deepEqual(layout.layoutNodes.get('D').children, []) - t.deepEqual(layout.layoutNodes.get('E').children, ['F']) + t.same(layout.layoutNodes.get('C').children, []) + t.same(layout.layoutNodes.get('D').children, []) + t.same(layout.layoutNodes.get('E').children, ['F']) t.equal(layout.layoutNodes.get('F').parent.id, layout.layoutNodes.get('E').id) - t.deepEqual(layout.layoutNodes.get('F').children, []) + t.same(layout.layoutNodes.get('F').children, []) t.end() }) @@ -98,7 +98,7 @@ test('Visualizer - layer - layout stems are healthy on processBetweenData', func expected.A.rawTotal = expected.A.scalable + expected.A.absolute t.equal(layout.layoutNodes.get('A').stem.raw.ownBetween.toFixed(2), expected.A.ownBetween.toFixed(2)) t.equal(layout.layoutNodes.get('A').stem.raw.ownDiameter.toFixed(2), expected.A.ownDiameter.toFixed(2)) - t.deepEqual(layout.layoutNodes.get('A').stem.ancestors.ids, expected.A.ancestors) + t.same(layout.layoutNodes.get('A').stem.ancestors.ids, expected.A.ancestors) t.equal(layout.layoutNodes.get('A').stem.ancestors.totalBetween.toFixed(2), expected.A.ancestorsBetween.toFixed(2)) t.equal(layout.layoutNodes.get('A').stem.ancestors.totalDiameter.toFixed(2), expected.A.ancestorsDiameter.toFixed(2)) t.equal(layout.layoutNodes.get('A').stem.lengths.scalable.toFixed(2), expected.A.scalable.toFixed(2)) @@ -115,7 +115,7 @@ test('Visualizer - layer - layout stems are healthy on processBetweenData', func expected.B.rawTotal = expected.B.scalable + expected.B.absolute t.equal(layout.layoutNodes.get('B').stem.raw.ownBetween.toFixed(2), expected.B.ownBetween.toFixed(2)) t.equal(layout.layoutNodes.get('B').stem.raw.ownDiameter.toFixed(2), expected.B.ownDiameter.toFixed(2)) - t.deepEqual(layout.layoutNodes.get('B').stem.ancestors.ids, expected.B.ancestors) + t.same(layout.layoutNodes.get('B').stem.ancestors.ids, expected.B.ancestors) t.equal(layout.layoutNodes.get('B').stem.ancestors.totalBetween.toFixed(2), expected.B.ancestorsBetween.toFixed(2)) t.equal(layout.layoutNodes.get('B').stem.ancestors.totalDiameter.toFixed(2), expected.B.ancestorsDiameter.toFixed(2)) t.equal(layout.layoutNodes.get('B').stem.lengths.scalable.toFixed(2), expected.B.scalable.toFixed(2)) @@ -132,7 +132,7 @@ test('Visualizer - layer - layout stems are healthy on processBetweenData', func expected.C.rawTotal = expected.C.scalable + expected.C.absolute t.equal(layout.layoutNodes.get('C').stem.raw.ownBetween.toFixed(2), expected.C.ownBetween.toFixed(2)) t.equal(layout.layoutNodes.get('C').stem.raw.ownDiameter.toFixed(2), expected.C.ownDiameter.toFixed(2)) - t.deepEqual(layout.layoutNodes.get('C').stem.ancestors.ids, expected.C.ancestors) + t.same(layout.layoutNodes.get('C').stem.ancestors.ids, expected.C.ancestors) t.equal(layout.layoutNodes.get('C').stem.ancestors.totalBetween.toFixed(2), expected.C.ancestorsBetween.toFixed(2)) t.equal(layout.layoutNodes.get('C').stem.ancestors.totalDiameter.toFixed(2), expected.C.ancestorsDiameter.toFixed(2)) t.equal(layout.layoutNodes.get('C').stem.lengths.scalable.toFixed(2), expected.C.scalable.toFixed(2)) @@ -149,7 +149,7 @@ test('Visualizer - layer - layout stems are healthy on processBetweenData', func expected.D.rawTotal = expected.D.scalable + expected.D.absolute t.equal(layout.layoutNodes.get('D').stem.raw.ownBetween.toFixed(2), expected.D.ownBetween.toFixed(2)) t.equal(layout.layoutNodes.get('D').stem.raw.ownDiameter.toFixed(2), expected.D.ownDiameter.toFixed(2)) - t.deepEqual(layout.layoutNodes.get('D').stem.ancestors.ids, expected.D.ancestors) + t.same(layout.layoutNodes.get('D').stem.ancestors.ids, expected.D.ancestors) t.equal(layout.layoutNodes.get('D').stem.ancestors.totalBetween.toFixed(2), expected.D.ancestorsBetween.toFixed(2)) t.equal(layout.layoutNodes.get('D').stem.ancestors.totalDiameter.toFixed(2), expected.D.ancestorsDiameter.toFixed(2)) t.equal(layout.layoutNodes.get('D').stem.lengths.scalable.toFixed(2), expected.D.scalable.toFixed(2)) @@ -166,7 +166,7 @@ test('Visualizer - layer - layout stems are healthy on processBetweenData', func expected.E.rawTotal = expected.E.scalable + expected.E.absolute t.equal(layout.layoutNodes.get('E').stem.raw.ownBetween.toFixed(2), expected.E.ownBetween.toFixed(2)) t.equal(layout.layoutNodes.get('E').stem.raw.ownDiameter.toFixed(2), expected.E.ownDiameter.toFixed(2)) - t.deepEqual(layout.layoutNodes.get('E').stem.ancestors.ids, expected.E.ancestors) + t.same(layout.layoutNodes.get('E').stem.ancestors.ids, expected.E.ancestors) t.equal(layout.layoutNodes.get('E').stem.ancestors.totalBetween.toFixed(2), expected.E.ancestorsBetween.toFixed(2)) t.equal(layout.layoutNodes.get('E').stem.ancestors.totalDiameter.toFixed(2), expected.E.ancestorsDiameter.toFixed(2)) t.equal(layout.layoutNodes.get('E').stem.lengths.scalable.toFixed(2), expected.E.scalable.toFixed(2)) @@ -183,7 +183,7 @@ test('Visualizer - layer - layout stems are healthy on processBetweenData', func expected.F.rawTotal = expected.F.scalable + expected.F.absolute t.equal(layout.layoutNodes.get('F').stem.raw.ownBetween.toFixed(2), expected.F.ownBetween.toFixed(2)) t.equal(layout.layoutNodes.get('F').stem.raw.ownDiameter.toFixed(2), expected.F.ownDiameter.toFixed(2)) - t.deepEqual(layout.layoutNodes.get('F').stem.ancestors.ids, expected.F.ancestors) + t.same(layout.layoutNodes.get('F').stem.ancestors.ids, expected.F.ancestors) t.equal(layout.layoutNodes.get('F').stem.ancestors.totalBetween.toFixed(2), expected.F.ancestorsBetween.toFixed(2)) t.equal(layout.layoutNodes.get('F').stem.ancestors.totalDiameter.toFixed(2), expected.F.ancestorsDiameter.toFixed(2)) t.equal(layout.layoutNodes.get('F').stem.lengths.scalable.toFixed(2), expected.F.scalable.toFixed(2)) @@ -248,7 +248,7 @@ test('Visualizer - layer - layout scale is healthy on calculateScaleFactor', fun const expectedScaleFactor = 25.7102 - t.deepEqual(layout.scale.scalesBySmallest.map(weight => [weight.category, weight.weight.toFixed(4)]), [ + t.same(layout.scale.scalesBySmallest.map(weight => [weight.category, weight.weight.toFixed(4)]), [ ['shortest', expectedScaleFactor + ''], ['diameter clamp', '30.1336'], ['q50 1-1-sqrt(2) triangle', '32.9860'], @@ -344,7 +344,7 @@ test('Visualizer - layer - layout positioning is healthy on formClumpPyramid', f t.equal(layout.layoutNodes.get('D').stem.lengths.rawTotal.toFixed(2), '78.46') t.equal(layout.layoutNodes.get('F').stem.lengths.rawTotal.toFixed(2), '108.90') const byLeafOnly = nodeId => !layout.layoutNodes.get(nodeId).children.length - t.deepEqual(layout.positioning.order.filter(byLeafOnly), ['C', 'F', 'D']) + t.same(layout.positioning.order.filter(byLeafOnly), ['C', 'F', 'D']) t.end() }) diff --git a/test/visualizer-layout-node-allocation.test.js b/test/visualizer-layout-node-allocation.test.js index 7468ebca..f6ff19e1 100644 --- a/test/visualizer-layout-node-allocation.test.js +++ b/test/visualizer-layout-node-allocation.test.js @@ -114,7 +114,7 @@ test('Visualizer layout - node allocation - blocks do not overlap or exceed allo t.equal(blocks[i - 1].end, blocks[i].begin) } - t.deepEqual(blocks.map(block => block.layoutNode.id), layout.positioning.order) + t.same(blocks.map(block => block.layoutNode.id), layout.positioning.order) t.end() }) @@ -141,7 +141,7 @@ test('Visualizer layout - node allocation - xy positions of leaves are allocated const { x, y } = block.layoutNode.position t.ok(x > 0) t.ok(y > 0) - t.deepEqual(segment.line.pointAtLength(block.center - segment.begin), { x, y }) + t.same(segment.line.pointAtLength(block.center - segment.begin), { x, y }) } } @@ -187,7 +187,7 @@ test('Visualizer layout - node allocation - xy positions of nodes are allocated }).length } - t.deepEqual(layout.positioning.order, [8, 7, 5, 2]) + t.same(layout.positioning.order, [8, 7, 5, 2]) t.equal(positionById[1].x, layout.settings.svgWidth / 2) t.equal(positionById[1].y, layout.settings.svgDistanceFromEdge + (scaledStemById[1].ownDiameter / 2)) @@ -296,8 +296,8 @@ test('Visualizer layout - node allocation - can handle collapsets', function (t) const keys = [...layout.layoutNodes.keys()] const clumpId = 'x1' - t.deepEqual([1, 2, 3, 'x1', 5, 6, 8, 9, 10, 11], keys) - t.deepEqual([4, 7], layout.layoutNodes.get(clumpId).collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([1, 2, 3, 'x1', 5, 6, 8, 9, 10, 11], keys) + t.same([4, 7], layout.layoutNodes.get(clumpId).collapsedNodes.map(layoutNode => layoutNode.id)) layout.positioning.formClumpPyramid() layout.positioning.placeNodes() @@ -359,9 +359,9 @@ test('Visualizer layout - node allocation - can handle collapsets with clumpy le const keys = [...layout.layoutNodes.keys()] const firstClumpId = 'x1' - t.deepEqual([1, 'x4', 5, 6, 'x1', 9, 11], keys) - t.deepEqual([8, 10], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) - t.deepEqual([2, 3, 4, 7], layout.layoutNodes.get('x4').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([1, 'x4', 5, 6, 'x1', 9, 11], keys) + t.same([8, 10], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([2, 3, 4, 7], layout.layoutNodes.get('x4').collapsedNodes.map(layoutNode => layoutNode.id)) layout.positioning.formClumpPyramid() layout.positioning.placeNodes() diff --git a/test/visualizer-layout-positioning.test.js b/test/visualizer-layout-positioning.test.js index d777e222..910a7506 100644 --- a/test/visualizer-layout-positioning.test.js +++ b/test/visualizer-layout-positioning.test.js @@ -28,23 +28,23 @@ test('Visualizer layout - positioning - mock topology', function (t) { const layout = generateLayout(dataSet, { labelMinimumSpace: 0, lineWidth: 0 }) t.ok(layout) - t.deepEqual(dataSet.clusterNodes.get(1).children, [2, 9]) + t.same(dataSet.clusterNodes.get(1).children, [2, 9]) t.equal(layout.layoutNodes.get(1).stem.lengths.scalable, 1) - t.deepEqual(dataSet.clusterNodes.get(2).children, [3, 6, 8]) + t.same(dataSet.clusterNodes.get(2).children, [3, 6, 8]) t.equal(layout.layoutNodes.get(2).stem.lengths.scalable, 1 + 1) - t.deepEqual(dataSet.clusterNodes.get(8).children, []) + t.same(dataSet.clusterNodes.get(8).children, []) t.equal(layout.layoutNodes.get(8).stem.lengths.scalable, 1 + 1 + 100) - t.deepEqual(dataSet.clusterNodes.get(6).children, [7]) + t.same(dataSet.clusterNodes.get(6).children, [7]) t.equal(layout.layoutNodes.get(6).stem.lengths.scalable, 1 + 1 + 1) - t.deepEqual(dataSet.clusterNodes.get(7).children, []) + t.same(dataSet.clusterNodes.get(7).children, []) t.equal(layout.layoutNodes.get(7).stem.lengths.scalable, 1 + 1 + 1 + 200) - t.deepEqual(dataSet.clusterNodes.get(3).children, [4, 5]) + t.same(dataSet.clusterNodes.get(3).children, [4, 5]) t.equal(layout.layoutNodes.get(3).stem.lengths.scalable, 1 + 1 + 1) - t.deepEqual(dataSet.clusterNodes.get(5).children, []) + t.same(dataSet.clusterNodes.get(5).children, []) t.equal(layout.layoutNodes.get(5).stem.lengths.scalable, 1 + 1 + 1 + 250) - t.deepEqual(dataSet.clusterNodes.get(4).children, []) + t.same(dataSet.clusterNodes.get(4).children, []) t.equal(layout.layoutNodes.get(4).stem.lengths.scalable, 1 + 1 + 1 + 150) - t.deepEqual(dataSet.clusterNodes.get(9).children, []) + t.same(dataSet.clusterNodes.get(9).children, []) t.equal(layout.layoutNodes.get(9).stem.lengths.scalable, 1 + 50) t.end() @@ -67,10 +67,10 @@ test('Visualizer layout - positioning - pyramid - simple', function (t) { const positioning = layout.positioning const expectedOrder = topologyToOrderedLeaves(expectedTopology) - t.deepEqual(positioning.order, expectedOrder) + t.same(positioning.order, expectedOrder) const expectedSortedIds = topologyToSortedIds(expectedTopology) - t.deepEqual(layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id), expectedSortedIds) + t.same(layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id), expectedSortedIds) t.end() }) @@ -92,10 +92,10 @@ test('Visualizer layout - positioning - pyramid - gaps', function (t) { const positioning = layout.positioning const expectedOrder = topologyToOrderedLeaves(expectedTopology) - t.deepEqual(positioning.order, expectedOrder) + t.same(positioning.order, expectedOrder) const expectedSortedIds = topologyToSortedIds(expectedTopology) - t.deepEqual(layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id), expectedSortedIds) + t.same(layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id), expectedSortedIds) t.end() }) @@ -123,10 +123,10 @@ test('Visualizer layout - positioning - pyramid - clumping tiny together with lo const positioning = layout.positioning const expectedOrder = topologyToOrderedLeaves(expectedTopology) - t.deepEqual(positioning.order, expectedOrder) + t.same(positioning.order, expectedOrder) const expectedSortedIds = topologyToSortedIds(expectedTopology) - t.deepEqual(layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id), expectedSortedIds) + t.same(layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id), expectedSortedIds) t.end() }) @@ -167,11 +167,11 @@ test('Visualizer layout - positioning - pyramid - example in docs', function (t) const positioning = layout.positioning const expectedOrder = topologyToOrderedLeaves(expectedTopology) - t.deepEqual(positioning.order, expectedOrder) + t.same(positioning.order, expectedOrder) const expectedSortedIds = topologyToSortedIds(expectedTopology) - t.deepEqual(expectedSortedIds, [1, 2, 10, 3, 11, 4, 7, 12, 5, 8, 16, 13, 18, 6, 14, 9, 15, 17]) - t.deepEqual(layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id), expectedSortedIds) + t.same(expectedSortedIds, [1, 2, 10, 3, 11, 4, 7, 12, 5, 8, 16, 13, 18, 6, 14, 9, 15, 17]) + t.same(layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id), expectedSortedIds) t.end() }) @@ -190,7 +190,7 @@ test('Visualizer layout - positioning - debugInspect', function (t) { const positioning = layout.positioning t.equal(layout.scale.scaleFactor, 3) - t.deepEqual(positioning.debugInspect(), [ + t.same(positioning.debugInspect(), [ '', '1.9 ---------- 150', '1.2.3.4.12 ------------------------------ 450', @@ -225,11 +225,11 @@ test('Visualizer layout - positioning - pyramid - can handle subsets', function positioning.formClumpPyramid() const expectedOrder = topologyToOrderedLeaves(expectedTopology) - t.deepEqual(positioning.order, expectedOrder) + t.same(positioning.order, expectedOrder) const expectedSortedIds = topologyToSortedIds(expectedTopology) const sortedLayoutNodes = layout.getSortedLayoutNodes().map(layoutNode => layoutNode.id) - t.deepEqual(sortedLayoutNodes, expectedSortedIds.filter(id => id !== 1 && id !== 2)) + t.same(sortedLayoutNodes, expectedSortedIds.filter(id => id !== 1 && id !== 2)) t.end() }) @@ -250,9 +250,9 @@ test('Visualizer layout - positioning - pyramid - can handle collapsets', functi layout.processHierarchy({ collapseNodes: true }) const keys = [...layout.layoutNodes.keys()] - t.deepEqual([1, 'x3', 11, 'x1', 5, 7, 9, 10, 12], keys) - t.deepEqual([4, 6], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) - t.deepEqual([2, 3, 8], layout.layoutNodes.get('x3').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([1, 'x3', 11, 'x1', 5, 7, 9, 10, 12], keys) + t.same([4, 6], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([2, 3, 8], layout.layoutNodes.get('x3').collapsedNodes.map(layoutNode => layoutNode.id)) // Arbitrary Map order being issue here // const clumpId = [...layout.layoutNodes.keys()].find(key => ['clump', 2, 3, 8].every(c => ('' + key).includes(c))) @@ -260,7 +260,7 @@ test('Visualizer layout - positioning - pyramid - can handle collapsets', functi positioning.formClumpPyramid() const expectedOrder = topologyToOrderedLeaves(expectedTopology) - t.deepEqual(positioning.order, expectedOrder) + t.same(positioning.order, expectedOrder) const expectedClumpedTopology = [ ['1.12', 50], @@ -270,7 +270,7 @@ test('Visualizer layout - positioning - pyramid - can handle collapsets', functi ['1.x3.11', 100] ] const expectedSortedIds = topologyToSortedIds(expectedClumpedTopology, false) - t.deepEqual(layout.getSortedLayoutNodes().map(layoutNode => `${layoutNode.id}`), expectedSortedIds) + t.same(layout.getSortedLayoutNodes().map(layoutNode => `${layoutNode.id}`), expectedSortedIds) t.ok(layout.ejectedLayoutNodeIds.includes('x2')) @@ -292,14 +292,14 @@ test('Visualizer layout - positioning - pyramid - can handle collapsets with clu layout.processHierarchy({ collapseNodes: true }) const keys = [...layout.layoutNodes.keys()] - t.deepEqual([1, 'x4', 11, 'x1', 5, 7, 9, 10], keys) - t.deepEqual([4, 6], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) - t.deepEqual([2, 12, 3, 8], layout.layoutNodes.get('x4').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([1, 'x4', 11, 'x1', 5, 7, 9, 10], keys) + t.same([4, 6], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([2, 12, 3, 8], layout.layoutNodes.get('x4').collapsedNodes.map(layoutNode => layoutNode.id)) const positioning = layout.positioning positioning.formClumpPyramid() - t.deepEqual(positioning.order, [5, 7, 10, 11]) + t.same(positioning.order, [5, 7, 10, 11]) const expectedClumpedTopology = [ ['1.x4.x1.5', 401], @@ -309,7 +309,7 @@ test('Visualizer layout - positioning - pyramid - can handle collapsets with clu ] const expectedSortedIds = topologyToSortedIds(expectedClumpedTopology, false) - t.deepEqual(layout.getSortedLayoutNodes().map(layoutNode => `${layoutNode.id}`), expectedSortedIds) + t.same(layout.getSortedLayoutNodes().map(layoutNode => `${layoutNode.id}`), expectedSortedIds) t.ok(layout.ejectedLayoutNodeIds.includes('x2')) t.ok(layout.ejectedLayoutNodeIds.includes('x3')) diff --git a/test/visualizer-layout-scale.test.js b/test/visualizer-layout-scale.test.js index 42579b3a..1ccfae6d 100644 --- a/test/visualizer-layout-scale.test.js +++ b/test/visualizer-layout-scale.test.js @@ -120,7 +120,7 @@ test('Visualizer layout - scale - constrained longest superseeds other weights', layout.updateScale() t.equal(layout.scale.scalesBySmallest[0].category, 'longest constrained') - t.notEqual(layout.scale.scalesBySmallest[1].category, 'longest') + t.not(layout.scale.scalesBySmallest[1].category, 'longest') t.equal(layout.scale.decisiveWeight.category, 'longest constrained') t.equal(layout.scale.finalSvgHeight, svgHeight) t.ok(layout.scale.scaleFactor < 0.35 && layout.scale.scaleFactor > 0.3) @@ -349,7 +349,7 @@ test('Visualizer layout - scale - calculation height always greater thans longes // Just long enough to have an absolute just below the amount that fits in svgHeight ['1.3.' + Array(20).fill(4).map((num, index) => num + index).join('.'), 5] ]) - t.equals(layoutWithScaleModifier.scale.decisiveWeight.modifier.toFixed(2), '0.57') + t.equal(layoutWithScaleModifier.scale.decisiveWeight.modifier.toFixed(2), '0.57') /* TODO - fix error where this fails with error from arrayFlatten recursion being too deep // Very slow test - keep it commented out and uncomment as a smoke test for very large profile issues @@ -367,7 +367,7 @@ test('Visualizer layout - scale - calculation height always greater thans longes // Long enough chain that absolute total exceeds svgHeight ['1.6' + Array(26).fill(7).map((num, index) => num + index).join('.'), 1] ]) - t.equals(layoutAdjustedThreshold.collapsedLayout.collapseThreshold.toFixed(2), '26.10') + t.equal(layoutAdjustedThreshold.collapsedLayout.collapseThreshold.toFixed(2), '26.10') t.end() }) diff --git a/test/visualizer-layout-stems.test.js b/test/visualizer-layout-stems.test.js index 953b8ee8..4f899f30 100644 --- a/test/visualizer-layout-stems.test.js +++ b/test/visualizer-layout-stems.test.js @@ -25,7 +25,7 @@ test('Visualizer layout - stems - calculates length based on ancestors and scale const stem = layout.layoutNodes.get(16).stem const totalStemLength = stem.lengths - t.deepEqual(stem.ancestors.ids, [1, 5, 7, 8, 10]) + t.same(stem.ancestors.ids, [1, 5, 7, 8, 10]) t.equal(totalStemLength.scalable.toFixed(8), '21897.14445863') t.equal(totalStemLength.absolute, (2 * 2 * 5) + (3 * 5)) t.equal(totalStemLength.rawTotal, totalStemLength.scalable + totalStemLength.absolute) @@ -54,15 +54,15 @@ test('Visualizer layout - stems - identifies leaves', function (t) { const dataSet = loadData({ debugMode: true }, mockTopology(topology)) const layout = generateLayout(dataSet, { labelMinimumSpace: 0, lineWidth: 0 }) - t.deepEqual(layout.layoutNodes.get(1).stem.leaves.ids, [4, 5, 7, 8, 9]) - t.deepEqual(layout.layoutNodes.get(9).stem.leaves.ids, []) - t.deepEqual(layout.layoutNodes.get(2).stem.leaves.ids, [4, 5, 7, 8]) - t.deepEqual(layout.layoutNodes.get(3).stem.leaves.ids, [4, 5]) - t.deepEqual(layout.layoutNodes.get(6).stem.leaves.ids, [7]) - t.deepEqual(layout.layoutNodes.get(4).stem.leaves.ids, []) - t.deepEqual(layout.layoutNodes.get(5).stem.leaves.ids, []) - t.deepEqual(layout.layoutNodes.get(7).stem.leaves.ids, []) - t.deepEqual(layout.layoutNodes.get(8).stem.leaves.ids, []) + t.same(layout.layoutNodes.get(1).stem.leaves.ids, [4, 5, 7, 8, 9]) + t.same(layout.layoutNodes.get(9).stem.leaves.ids, []) + t.same(layout.layoutNodes.get(2).stem.leaves.ids, [4, 5, 7, 8]) + t.same(layout.layoutNodes.get(3).stem.leaves.ids, [4, 5]) + t.same(layout.layoutNodes.get(6).stem.leaves.ids, [7]) + t.same(layout.layoutNodes.get(4).stem.leaves.ids, []) + t.same(layout.layoutNodes.get(5).stem.leaves.ids, []) + t.same(layout.layoutNodes.get(7).stem.leaves.ids, []) + t.same(layout.layoutNodes.get(8).stem.leaves.ids, []) t.end() }) diff --git a/test/visualizer-layout.test.js b/test/visualizer-layout.test.js index 0ab1c945..178a2734 100644 --- a/test/visualizer-layout.test.js +++ b/test/visualizer-layout.test.js @@ -54,8 +54,8 @@ test('Visualizer layout - builds sublayout from connection', function (t) { const traversedLayout = initialLayout.createSubLayout(traversedLayoutNode, uncollapsedSettings) t.equal(traversedLayout.parentLayout.rootLayoutNode.id, initialLayout.rootLayoutNode.id) const toValidLink = createLinkValidator(traversedLayout) - t.deepEqual([...traversedLayout.layoutNodes.values()].map(toTypeId), ['ShortcutNode-shortcut:3', 'AggregateNode-4', 'ShortcutNode-5']) - t.deepEqual([...traversedLayout.layoutNodes.values()].map(toValidLink), ['shortcut:3 => 4', '4 => 5', '5 => ']) + t.same([...traversedLayout.layoutNodes.values()].map(toTypeId), ['ShortcutNode-shortcut:3', 'AggregateNode-4', 'ShortcutNode-5']) + t.same([...traversedLayout.layoutNodes.values()].map(toValidLink), ['shortcut:3 => 4', '4 => 5', '5 => ']) t.end() }) @@ -75,13 +75,13 @@ test('Visualizer layout - collapse - collapses vertically (except root and Ps)', layout.updateScale() const toValidLink = createLinkValidator(layout) const actualBefore = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualBefore, ['1 => 2', '2 => 3', '3 => 4', '4 => 5', '5 => ']) + t.same(actualBefore, ['1 => 2', '2 => 3', '3 => 4', '4 => 5', '5 => ']) layout.collapseNodes() layout.processBetweenData() layout.updateScale() const actualAfter = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualAfter, ['1 => x1', 'x1 => 4', '4 => 5', '5 => ']) - t.deepEqual([2, 3], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same(actualAfter, ['1 => x1', 'x1 => 4', '4 => 5', '5 => ']) + t.same([2, 3], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) t.throws(() => { const brokenLayout = new Layout({ dataNodes }, settings) @@ -106,7 +106,7 @@ test('Visualizer layout - collapse - does not collapse shortcut nodes', function const traversedLayoutNode = initialLayout.layoutNodes.get(2) const traversedLayout = initialLayout.createSubLayout(traversedLayoutNode, settings) traversedLayout.processHierarchy() - t.deepEqual([...traversedLayout.layoutNodes.values()].map(toTypeId), ['ShortcutNode-shortcut:1', 'AggregateNode-2', 'ShortcutNode-3', 'ShortcutNode-4', 'ShortcutNode-5']) + t.same([...traversedLayout.layoutNodes.values()].map(toTypeId), ['ShortcutNode-shortcut:1', 'AggregateNode-2', 'ShortcutNode-3', 'ShortcutNode-4', 'ShortcutNode-5']) t.end() }) @@ -127,14 +127,14 @@ test('Visualizer layout - collapse - merges shortcuts pointing to the same view' const initialLayout = new Layout({ dataNodes: initialDataNodes }, settings) initialLayout.processHierarchy() let toValidLink = createLinkValidator(initialLayout) - t.deepEqual([...initialLayout.layoutNodes.values()].map(toTypeId), ['ClusterNode-1', 'ClusterNode-2', 'ClusterNode-3', 'ArtificialNode-x2', 'ClusterNode-5', 'ClusterNode-7', 'ClusterNode-9']) - t.deepEqual([...initialLayout.layoutNodes.values()].map(toValidLink), ['1 => 2', '2 => 3', '3 => x2', 'x2 => 5;7;9', '5 => ', '7 => ', '9 => ']) + t.same([...initialLayout.layoutNodes.values()].map(toTypeId), ['ClusterNode-1', 'ClusterNode-2', 'ClusterNode-3', 'ArtificialNode-x2', 'ClusterNode-5', 'ClusterNode-7', 'ClusterNode-9']) + t.same([...initialLayout.layoutNodes.values()].map(toValidLink), ['1 => 2', '2 => 3', '3 => x2', 'x2 => 5;7;9', '5 => ', '7 => ', '9 => ']) const traversedLayoutNode = initialLayout.layoutNodes.get(3) const traversedLayout = initialLayout.createSubLayout(traversedLayoutNode, settings) traversedLayout.processHierarchy() toValidLink = createLinkValidator(traversedLayout) - t.deepEqual([...traversedLayout.layoutNodes.values()].map(toTypeId), ['ShortcutNode-shortcut:2', 'AggregateNode-3', 'ShortcutNode-shortcut:x2']) - t.deepEqual([...traversedLayout.layoutNodes.values()].map(toValidLink), ['shortcut:2 => 3', '3 => shortcut:x2', 'shortcut:x2 => ']) + t.same([...traversedLayout.layoutNodes.values()].map(toTypeId), ['ShortcutNode-shortcut:2', 'AggregateNode-3', 'ShortcutNode-shortcut:x2']) + t.same([...traversedLayout.layoutNodes.values()].map(toValidLink), ['shortcut:2 => 3', '3 => shortcut:x2', 'shortcut:x2 => ']) t.ok(initialLayout.ejectedLayoutNodeIds.includes('x1')) t.end() @@ -154,14 +154,14 @@ test('Visualizer layout - collapse - collapses vertically with break (except roo layout.updateScale() const toValidLink = createLinkValidator(layout) const actualBefore = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualBefore, ['1 => 2', '2 => 3', '3 => 4', '4 => 5', '5 => 6', '6 => 7', '7 => 8', '8 => 9', '9 => ']) + t.same(actualBefore, ['1 => 2', '2 => 3', '3 => 4', '4 => 5', '5 => 6', '6 => 7', '7 => 8', '8 => 9', '9 => ']) layout.collapseNodes() layout.processBetweenData() layout.updateScale() const actualAfter = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualAfter, ['1 => x2', 'x2 => 4', '4 => 5', '5 => x1', 'x1 => 8', '8 => 9', '9 => ']) - t.deepEqual([6, 7], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) - t.deepEqual([2, 3], layout.layoutNodes.get('x2').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same(actualAfter, ['1 => x2', 'x2 => 4', '4 => 5', '5 => x1', 'x1 => 8', '8 => 9', '9 => ']) + t.same([6, 7], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([2, 3], layout.layoutNodes.get('x2').collapsedNodes.map(layoutNode => layoutNode.id)) t.end() }) @@ -180,13 +180,13 @@ test('Visualizer layout - collapse - collapses vertically until minimum count th layout.updateScale() const toValidLink = createLinkValidator(layout) const actualBefore = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualBefore, ['1 => 2', '2 => 3', '3 => 4', '4 => 5;6', '5 => ', '6 => ']) + t.same(actualBefore, ['1 => 2', '2 => 3', '3 => 4', '4 => 5;6', '5 => ', '6 => ']) layout.collapseNodes() layout.processBetweenData() layout.updateScale() const actualAfter = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualAfter, ['1 => 2', '2 => x1', 'x1 => ']) - t.deepEqual([3, 4, 5, 6], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same(actualAfter, ['1 => 2', '2 => x1', 'x1 => ']) + t.same([3, 4, 5, 6], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) t.end() }) @@ -213,13 +213,13 @@ test('Visualizer layout - collapse - collapses horizontally', function (t) { layout.updateScale() const toValidLink = createLinkValidator(layout) const actualBefore = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualBefore, ['1 => 2', '2 => 3;5;7', '3 => 4', '4 => ', '5 => 6', '6 => ', '7 => 8', '8 => ']) + t.same(actualBefore, ['1 => 2', '2 => 3;5;7', '3 => 4', '4 => ', '5 => 6', '6 => ', '7 => 8', '8 => ']) layout.collapseNodes() layout.processBetweenData() layout.updateScale() const actualAfter = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualAfter, ['1 => 2', '2 => x1;5', 'x1 => 4;8', '4 => ', '8 => ', '5 => 6', '6 => ']) - t.deepEqual([3, 7], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same(actualAfter, ['1 => 2', '2 => x1;5', 'x1 => 4;8', '4 => ', '8 => ', '5 => 6', '6 => ']) + t.same([3, 7], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) t.end() }) @@ -243,13 +243,13 @@ test('Visualizer layout - collapse - collapses both horizontally and vertically layout.updateScale() const toValidLink = createLinkValidator(layout) const actualBefore = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualBefore, ['1 => 2', '2 => 3;6', '3 => 4', '4 => 5', '5 => ', '6 => 7', '7 => 8', '8 => ']) + t.same(actualBefore, ['1 => 2', '2 => 3;6', '3 => 4', '4 => 5', '5 => ', '6 => 7', '7 => 8', '8 => ']) layout.collapseNodes() layout.processBetweenData() layout.updateScale() const actualAfter = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualAfter, ['1 => x2', 'x2 => 4;7', '4 => 5', '5 => ', '7 => 8', '8 => ']) - t.deepEqual([2, 3, 6], layout.layoutNodes.get('x2').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same(actualAfter, ['1 => x2', 'x2 => 4;7', '4 => 5', '5 => ', '7 => 8', '8 => ']) + t.same([2, 3, 6], layout.layoutNodes.get('x2').collapsedNodes.map(layoutNode => layoutNode.id)) t.ok(layout.ejectedLayoutNodeIds.includes('x1')) @@ -275,17 +275,17 @@ test('Visualizer layout - collapse - vertically collapses subset with missing ro const toValidLink = createLinkValidator(layout) const actualBefore = [...layout.layoutNodes.values()].map(toValidLink) const sortedBefore = layout.getSortedLayoutNodes().map(toValidLink) - t.deepEqual(actualBefore, ['2 => 3', '3 => 4', '4 => 5', '5 => 6', '6 => ', '7 => 8', '8 => 9', '9 => 10', '10 => ']) - t.deepEqual(sortedBefore, ['2 => 3', '7 => 8', '3 => 4', '8 => 9', '4 => 5', '9 => 10', '5 => 6', '10 => ', '6 => ']) + t.same(actualBefore, ['2 => 3', '3 => 4', '4 => 5', '5 => 6', '6 => ', '7 => 8', '8 => 9', '9 => 10', '10 => ']) + t.same(sortedBefore, ['2 => 3', '7 => 8', '3 => 4', '8 => 9', '4 => 5', '9 => 10', '5 => 6', '10 => ', '6 => ']) layout.collapseNodes() layout.processBetweenData() layout.updateScale() const actualAfter = [...layout.layoutNodes.values()].map(toValidLink) const sortedAfter = layout.getSortedLayoutNodes().map(toValidLink) - t.deepEqual(actualAfter, ['2 => x1', 'x1 => 5', '5 => 6', '6 => ', '7 => 8', '8 => 9', '9 => 10', '10 => ']) - t.deepEqual(sortedAfter, ['2 => x1', '7 => 8', 'x1 => 5', '8 => 9', '5 => 6', '9 => 10', '6 => ', '10 => ']) - t.deepEqual([3, 4], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same(actualAfter, ['2 => x1', 'x1 => 5', '5 => 6', '6 => ', '7 => 8', '8 => 9', '9 => 10', '10 => ']) + t.same(sortedAfter, ['2 => x1', '7 => 8', 'x1 => 5', '8 => 9', '5 => 6', '9 => 10', '6 => ', '10 => ']) + t.same([3, 4], layout.layoutNodes.get('x1').collapsedNodes.map(layoutNode => layoutNode.id)) t.end() }) @@ -308,13 +308,13 @@ test('Visualizer layout - collapse - collapses subset both vertically and horizo layout.updateScale() const toValidLink = createLinkValidator(layout) const actualBefore = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualBefore, ['1 => 2', '2 => 3;6', '3 => 4', '4 => ', '6 => 7', '7 => ']) + t.same(actualBefore, ['1 => 2', '2 => 3;6', '3 => 4', '4 => ', '6 => 7', '7 => ']) layout.collapseNodes() layout.processBetweenData() layout.updateScale() const actualAfter = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualAfter, ['1 => 2', '2 => x2', 'x2 => 7', '7 => ']) - t.deepEqual([3, 6, 4], layout.layoutNodes.get('x2').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same(actualAfter, ['1 => 2', '2 => x2', 'x2 => 7', '7 => ']) + t.same([3, 6, 4], layout.layoutNodes.get('x2').collapsedNodes.map(layoutNode => layoutNode.id)) t.ok(layout.ejectedLayoutNodeIds.includes('x1')) t.end() @@ -352,14 +352,14 @@ test('Visualizer layout - collapse - complex example', function (t) { layout.updateScale() const toValidLink = createLinkValidator(layout) const actualBefore = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualBefore, ['1 => 2;3', '2 => ', '3 => 4;5;7;10', '4 => ', '5 => 6', '6 => ', '7 => 8;9', '8 => ', '9 => ', '10 => 11;12', '11 => ', '12 => 13', '13 => ']) + t.same(actualBefore, ['1 => 2;3', '2 => ', '3 => 4;5;7;10', '4 => ', '5 => 6', '6 => ', '7 => 8;9', '8 => ', '9 => ', '10 => 11;12', '11 => ', '12 => 13', '13 => ']) layout.collapseNodes() layout.processBetweenData() layout.updateScale() const actualAfter = [...layout.layoutNodes.values()].map(toValidLink) - t.deepEqual(actualAfter, ['1 => 2;3', '2 => ', '3 => x3;10', 'x3 => ', '10 => x2', 'x2 => ']) - t.deepEqual([11, 12, 13], layout.layoutNodes.get('x2').collapsedNodes.map(layoutNode => layoutNode.id)) - t.deepEqual([4, 5, 7, 6, 8, 9], layout.layoutNodes.get('x3').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same(actualAfter, ['1 => 2;3', '2 => ', '3 => x3;10', 'x3 => ', '10 => x2', 'x2 => ']) + t.same([11, 12, 13], layout.layoutNodes.get('x2').collapsedNodes.map(layoutNode => layoutNode.id)) + t.same([4, 5, 7, 6, 8, 9], layout.layoutNodes.get('x3').collapsedNodes.map(layoutNode => layoutNode.id)) t.ok(layout.ejectedLayoutNodeIds.includes('x1')) diff --git a/test/visualizer-line-coordinates.test.js b/test/visualizer-line-coordinates.test.js index 21529d5a..4f31cde8 100644 --- a/test/visualizer-line-coordinates.test.js +++ b/test/visualizer-line-coordinates.test.js @@ -150,12 +150,12 @@ test('Line Coordinates - calculates xy position of point at length', function (t spec = { x1: 0, y1: 0, x2: 3, y2: 4 } // 3-4-5 triangle line = new LineCoordinates(spec) t.equal(line.length, 5) - t.deepEqual(line.pointAtLength(2.5), { x: 1.5, y: 2 }) + t.same(line.pointAtLength(2.5), { x: 1.5, y: 2 }) spec = { x1: 1, y1: 1, x2: 4, y2: 5 } // 3-4-5 triangle translated by (1, 1) => 4-5-6 line = new LineCoordinates(spec) t.equal(line.length, 5) - t.deepEqual(line.pointAtLength(2.5), { x: 2.5, y: 3 }) + t.same(line.pointAtLength(2.5), { x: 2.5, y: 3 }) t.end() }) diff --git a/test/visualizer-util/verify-garbage-collection.js b/test/visualizer-util/verify-garbage-collection.js index b109d64a..0192692e 100644 --- a/test/visualizer-util/verify-garbage-collection.js +++ b/test/visualizer-util/verify-garbage-collection.js @@ -43,7 +43,7 @@ setImmediate(() => { test('Visualizer data - ensure callbackEvents are garbage collected', function (t) { global.gc() const amountGarbageCollected = getGCCount() - t.equals(amountGarbageCollected, callbackEventsGCExpected) + t.equal(amountGarbageCollected, callbackEventsGCExpected) t.end() }) }) diff --git a/test/visualizer-validation.test.js b/test/visualizer-validation.test.js index 277cc47b..4f9c595f 100644 --- a/test/visualizer-validation.test.js +++ b/test/visualizer-validation.test.js @@ -12,51 +12,51 @@ const { } = require('../visualizer/validation.js') test('Visualizer validation - isNumber', function (t) { - t.equals(isNumber(123), true) - t.equals(isNumber(Infinity), true) - t.equals(isNumber(1e+23), true) - t.equals(isNumber(1e-23), true) - t.equals(isNumber('123'), false) - t.equals(isNumber('1e23'), false) - t.equals(isNumber(NaN), false) + t.equal(isNumber(123), true) + t.equal(isNumber(Infinity), true) + t.equal(isNumber(1e+23), true) + t.equal(isNumber(1e-23), true) + t.equal(isNumber('123'), false) + t.equal(isNumber('1e23'), false) + t.equal(isNumber(NaN), false) t.end() }) test('Visualizer validation - numberiseIfNumericString', function (t) { - t.equals(numberiseIfNumericString(123), 123) - - t.equals(numberiseIfNumericString('123'), 123) - t.equals(numberiseIfNumericString('-123'), -123) - t.equals(numberiseIfNumericString('1.23'), 1.23) - t.equals(numberiseIfNumericString('1e+23'), 1e+23) - t.equals(numberiseIfNumericString('1e-23'), 1e-23) - t.equals(numberiseIfNumericString(' 123 '), 123) - - t.equals(numberiseIfNumericString('123%'), '123%') - t.equals(numberiseIfNumericString('A123'), 'A123') - t.equals(numberiseIfNumericString('1.2.3'), '1.2.3') - t.equals(numberiseIfNumericString(''), '') + t.equal(numberiseIfNumericString(123), 123) + + t.equal(numberiseIfNumericString('123'), 123) + t.equal(numberiseIfNumericString('-123'), -123) + t.equal(numberiseIfNumericString('1.23'), 1.23) + t.equal(numberiseIfNumericString('1e+23'), 1e+23) + t.equal(numberiseIfNumericString('1e-23'), 1e-23) + t.equal(numberiseIfNumericString(' 123 '), 123) + + t.equal(numberiseIfNumericString('123%'), '123%') + t.equal(numberiseIfNumericString('A123'), 'A123') + t.equal(numberiseIfNumericString('1.2.3'), '1.2.3') + t.equal(numberiseIfNumericString(''), '') t.end() }) test('Visualizer validation - validateKey', function (t) { const validOptions = ['1', '2', '3'] - t.equals(validateKey('2', validOptions), true) + t.equal(validateKey('2', validOptions), true) t.throws(() => validateKey(2, validOptions), new Error('Invalid key "2" (typeof number) passed, valid keys are: 1, 2, 3')) t.throws(() => validateKey('4', validOptions), new Error('Invalid key "4" (typeof string) passed, valid keys are: 1, 2, 3')) t.end() }) test('Visualizer validation - validateNumber', function (t) { - t.equals(validateNumber(2), 2) - t.equals(validateNumber(1e23), 1e23) + t.equal(validateNumber(2), 2) + t.equal(validateNumber(1e23), 1e23) t.throws(() => validateNumber('2'), new Error('Got string 2, must be a number')) t.throws(() => validateNumber(NaN), new Error('Got number NaN, must be a number')) - t.equals(validateNumber(Infinity, 'Allowed infinity', { isFinite: false }), Infinity) + t.equal(validateNumber(Infinity, 'Allowed infinity', { isFinite: false }), Infinity) t.throws(() => validateNumber(Infinity, 'Disallowed infinity'), new Error('Disallowed infinity: Got Infinity, must be finite')) - t.equals(validateNumber(-1, 'Allowed negative'), -1) + t.equal(validateNumber(-1, 'Allowed negative'), -1) t.throws(() => validateNumber(-1, 'Disallowed negative', { aboveZero: true }), new Error('Disallowed negative: Got -1, must be > 0')) t.end() }) @@ -73,24 +73,24 @@ test('Visualizer validation - uniqueMapKey', function (t) { [objectKey, 5] ]) - t.equals(uniqueMapKey('c', testMap), 'c') - t.equals(uniqueMapKey('a', testMap), 'a_1') - t.equals(uniqueMapKey('b', testMap), 'b_2') - t.equals(uniqueMapKey(99, testMap), '99_1') - t.equals(uniqueMapKey(objectKey2, testMap), objectKey2) - t.equals(uniqueMapKey(objectKey, testMap), '[object Object]_1') + t.equal(uniqueMapKey('c', testMap), 'c') + t.equal(uniqueMapKey('a', testMap), 'a_1') + t.equal(uniqueMapKey('b', testMap), 'b_2') + t.equal(uniqueMapKey(99, testMap), '99_1') + t.equal(uniqueMapKey(objectKey2, testMap), objectKey2) + t.equal(uniqueMapKey(objectKey, testMap), '[object Object]_1') - t.equals(uniqueMapKey('a', testMap, '', 1), 'a1') - t.equals(uniqueMapKey('b', testMap, '_', 1), 'b_2') - t.equals(uniqueMapKey('b', testMap, '_', 2), 'b_2') - t.equals(uniqueMapKey('b', testMap, '_', 3), 'b_3') - t.equals(uniqueMapKey('c', testMap, '--', 1), 'c--1') + t.equal(uniqueMapKey('a', testMap, '', 1), 'a1') + t.equal(uniqueMapKey('b', testMap, '_', 1), 'b_2') + t.equal(uniqueMapKey('b', testMap, '_', 2), 'b_2') + t.equal(uniqueMapKey('b', testMap, '_', 3), 'b_3') + t.equal(uniqueMapKey('c', testMap, '--', 1), 'c--1') testMap.set(uniqueMapKey('a', testMap), 6) - t.equals(uniqueMapKey('a', testMap), 'a_2') + t.equal(uniqueMapKey('a', testMap), 'a_2') testMap.set(uniqueMapKey('a', testMap), 7) - t.equals(uniqueMapKey('a', testMap), 'a_3') + t.equal(uniqueMapKey('a', testMap), 'a_3') testMap.set(uniqueMapKey('a', testMap), true) testMap.set(uniqueMapKey('a', testMap), true) @@ -100,9 +100,9 @@ test('Visualizer validation - uniqueMapKey', function (t) { testMap.delete('a_3') removeFromCounter('a_3', testMap, 'a', '_') - t.equals(uniqueMapKey('a', testMap), 'a_3') + t.equal(uniqueMapKey('a', testMap), 'a_3') testMap.set(uniqueMapKey('a', testMap), true) - t.equals(uniqueMapKey('a', testMap), 'a_6') + t.equal(uniqueMapKey('a', testMap), 'a_6') t.end() }) @@ -115,21 +115,21 @@ test('Visualizer validation - uniqueObjectKey', function (t) { 99: 4 } - t.equals(uniqueObjectKey('c', testObject), 'c') - t.equals(uniqueObjectKey('a', testObject), 'a_1') - t.equals(uniqueObjectKey('b', testObject), 'b_2') - t.equals(uniqueObjectKey(99, testObject), '99_1') + t.equal(uniqueObjectKey('c', testObject), 'c') + t.equal(uniqueObjectKey('a', testObject), 'a_1') + t.equal(uniqueObjectKey('b', testObject), 'b_2') + t.equal(uniqueObjectKey(99, testObject), '99_1') - t.equals(uniqueObjectKey('a', testObject, '', 1), 'a1') - t.equals(uniqueObjectKey('b', testObject, '_', 1), 'b_2') - t.equals(uniqueObjectKey('b', testObject, '_', 2), 'b_2') - t.equals(uniqueObjectKey('b', testObject, '_', 3), 'b_3') - t.equals(uniqueObjectKey('c', testObject, '--', 1), 'c--1') + t.equal(uniqueObjectKey('a', testObject, '', 1), 'a1') + t.equal(uniqueObjectKey('b', testObject, '_', 1), 'b_2') + t.equal(uniqueObjectKey('b', testObject, '_', 2), 'b_2') + t.equal(uniqueObjectKey('b', testObject, '_', 3), 'b_3') + t.equal(uniqueObjectKey('c', testObject, '--', 1), 'c--1') testObject[uniqueObjectKey('a', testObject)] = 5 - t.equals(uniqueObjectKey('a', testObject), 'a_2') + t.equal(uniqueObjectKey('a', testObject), 'a_2') testObject[uniqueObjectKey('a', testObject)] = 6 - t.equals(uniqueObjectKey('a', testObject), 'a_3') + t.equal(uniqueObjectKey('a', testObject), 'a_3') t.end() })