Skip to content

Commit

Permalink
chore: add node16 support (#382)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
RafaelGSS authored Nov 9, 2021
1 parent 2382aaf commit 08306d2
Show file tree
Hide file tree
Showing 58 changed files with 580 additions and 569 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions .nycrc.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .taprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
timeout: 50
jobs: 1
statements: 95
branches: 90
functions: 95
lines: 98
test-env: NODE_OPTIONS=--no-warnings
2 changes: 1 addition & 1 deletion analysis/stack-trace/frames.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 2 additions & 1 deletion collect/stack-trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions test/analysis-aggregate-combine.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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],
Expand All @@ -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],
Expand All @@ -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: [],
Expand All @@ -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: [],
Expand Down
34 changes: 17 additions & 17 deletions test/analysis-aggregate-mark-http.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}

Expand All @@ -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()
}))
Expand All @@ -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()
}))
Expand Down
12 changes: 6 additions & 6 deletions test/analysis-aggregate-mark-module.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)
Expand Down
14 changes: 7 additions & 7 deletions test/analysis-aggregate-mark-party.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)
Expand Down
Loading

0 comments on commit 08306d2

Please sign in to comment.