Skip to content

Commit

Permalink
chore: add support to v16 (#348)
Browse files Browse the repository at this point in the history
* chore: upgrade tap version

* chore: add support to v16+

* chore: add branches to 97

* chore: remove branches cov

* fix(test): use process.exit to close spawned process

* tests: adjust process.exit to the nextTick

* tests: fix typo

* tests: adjust coverage minumum to 99

* chore: add nycrc config to avoid wrap spawn process
  • Loading branch information
RafaelGSS authored Nov 10, 2021
1 parent 0e0b7e9 commit 9ac80d5
Show file tree
Hide file tree
Showing 29 changed files with 112 additions and 107 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
2 changes: 2 additions & 0 deletions .nycrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# # This option avoid an wrap over spawn by nyc that affects our tests.
use-spawn-wrap: true
5 changes: 5 additions & 0 deletions .taprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jobs: 1
timeout: 60
branches: 97
statements: 99
lines: 99
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"scripts": {
"visualize-watch": "node debug/visualize-watch.js",
"visualize-all": "node debug/visualize-all.js",
"test": "standard | snazzy && tap -j1 --timeout=50 --no-cov test/*.test.js",
"test": "standard | snazzy && tap --no-cov test/*.test.js",
"ci-lint": "standard | snazzy",
"ci-test": "tap -j1 --timeout=50 test/*.test.js",
"ci-cov": "tap -j1 --timeout=60 --100 test/*.test.js",
"ci-test": "tap test/*.test.js",
"ci-cov": "tap test/*.test.js",
"lint": "standard --fix | snazzy"
},
"dependencies": {
Expand Down Expand Up @@ -50,7 +50,7 @@
"snazzy": "^9.0.0",
"standard": "^16.0.3",
"startpoint": "^0.3.2",
"tap": "^14.11.0",
"tap": "^15.0.10",
"xorshift": "^1.1.1"
},
"engines": {
Expand Down
20 changes: 10 additions & 10 deletions test/analysis-cpu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ test('analyse cpu - one mode', async function (t) {
const goodCPU = generateProcessStat({
cpu: [100, 100, 120, 100, 110, 100, 100, 110, 90, 110]
}, noise)
t.strictEqual(await analyseCPU({}, goodCPU, []), 'none')
t.equal(await analyseCPU({}, goodCPU, []), 'none')

const badCPU = generateProcessStat({
cpu: [50, 40, 10, 10, 80, 50, 40, 1, 10, 30, 10]
}, noise)
t.strictEqual(await analyseCPU({}, badCPU, []), 'performance')
t.equal(await analyseCPU({}, badCPU, []), 'performance')
}

t.end()
Expand All @@ -26,12 +26,12 @@ test('analyse cpu - two mode', async function (t) {
const goodCPU = generateProcessStat({
cpu: [200, 200, 100, 90, 190, 200, 80, 110, 190, 200]
}, noise)
t.strictEqual(await analyseCPU({}, goodCPU, []), 'none')
t.equal(await analyseCPU({}, goodCPU, []), 'none')

const badCPU = generateProcessStat({
cpu: [200, 200, 15, 10, 190, 200, 5, 15, 190, 200]
}, noise)
t.strictEqual(await analyseCPU({}, badCPU, []), 'performance')
t.equal(await analyseCPU({}, badCPU, []), 'performance')
}

t.end()
Expand All @@ -47,15 +47,15 @@ test('analyse cpu - two mode - opposite clusters', async function (t) {
200, 200, 100, 90, 190, 200, 80, 110, 190, 200
]
}, noise)
t.strictEqual(await analyseCPU({}, goodCPU, []), 'none')
t.equal(await analyseCPU({}, goodCPU, []), 'none')

const badCPU = generateProcessStat({
cpu: [
200, 200, 15, 10, 190, 200, 5, 15, 190, 200,
200, 200, 15, 10, 190, 200, 5, 15, 190, 200
]
}, noise)
t.strictEqual(await analyseCPU({}, badCPU, []), 'performance')
t.equal(await analyseCPU({}, badCPU, []), 'performance')
}

t.end()
Expand All @@ -66,12 +66,12 @@ test('analyse cpu - little data', async function (t) {
const goodCPU = generateProcessStat({
cpu: [100, 100, 120]
}, noise)
t.strictEqual(await analyseCPU({}, goodCPU, []), 'data')
t.equal(await analyseCPU({}, goodCPU, []), 'data')

const badCPU = generateProcessStat({
cpu: [50, 40, 10]
}, noise)
t.strictEqual(await analyseCPU({}, badCPU, []), 'data')
t.equal(await analyseCPU({}, badCPU, []), 'data')
}

t.end()
Expand All @@ -82,12 +82,12 @@ test('analyse cpu - small cluster data', async function (t) {
const goodCPU = generateProcessStat({
cpu: [200, 200, 100, 90, 190, 200, 80, 110, 190, 0]
}, noise)
t.strictEqual(await analyseCPU({}, goodCPU, []), 'none')
t.equal(await analyseCPU({}, goodCPU, []), 'none')

const badCPU = generateProcessStat({
cpu: [50, 40, 10, 10, 200, 50, 40, 10, 10, 30, 10]
}, noise)
t.strictEqual(await analyseCPU({}, badCPU, []), 'performance')
t.equal(await analyseCPU({}, badCPU, []), 'performance')
}

t.end()
Expand Down
8 changes: 4 additions & 4 deletions test/analysis-delay.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ test('analyse delay - to high', function (t) {
const goodDelay = generateProcessStat({
delay: [1, 2, 1, 1, 2, 2, 3, 1]
}, noise)
t.strictEqual(analyseDelay({}, goodDelay, []), 'none')
t.equal(analyseDelay({}, goodDelay, []), 'none')

const badDelay = generateProcessStat({
delay: [10, 8, 6, 10, 15, 10, 4]
}, noise)
t.strictEqual(analyseDelay({}, badDelay, []), 'performance')
t.equal(analyseDelay({}, badDelay, []), 'performance')
}

t.end()
Expand All @@ -24,12 +24,12 @@ test('analyse delay - spikes', function (t) {
const goodDelay = generateProcessStat({
delay: [1, 2, 1, 20, 2, 2, 3, 1]
}, 1)
t.strictEqual(analyseDelay({}, goodDelay, []), 'none')
t.equal(analyseDelay({}, goodDelay, []), 'none')

const badDelay = generateProcessStat({
delay: [1, 2, 1, 110, 2, 2, 3, 1]
}, 1)
t.strictEqual(analyseDelay({}, badDelay, []), 'performance')
t.equal(analyseDelay({}, badDelay, []), 'performance')

t.end()
})
12 changes: 6 additions & 6 deletions test/analysis-guess-interval.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('guess interval - expected data', function (t) {
}, noise, 10)

const interval = guessInterval(data)
t.strictDeepEqual(interval, [5, 12])
t.strictSame(interval, [5, 12])
}

t.end()
Expand All @@ -30,7 +30,7 @@ test('guess interval - trims 100 ms from left and right side', function (t) {
}, noise)

const interval = guessInterval(data)
t.strictDeepEqual(interval, [14, 23])
t.strictSame(interval, [14, 23])
}

t.end()
Expand All @@ -43,7 +43,7 @@ test('guess interval - overtrim is not possible', function (t) {
}, noise)

const interval = guessInterval(data)
t.strictDeepEqual(interval, [7, 7])
t.strictSame(interval, [7, 7])
}

t.end()
Expand All @@ -56,7 +56,7 @@ test('guess interval - missing left tail', function (t) {
}, noise, 10)

const interval = guessInterval(data)
t.strictDeepEqual(interval, [5, 12])
t.strictSame(interval, [5, 12])
}

t.end()
Expand All @@ -69,7 +69,7 @@ test('guess interval - missing right tail', function (t) {
}, noise, 10)

const interval = guessInterval(data)
t.strictDeepEqual(interval, [0, 5])
t.strictSame(interval, [0, 5])
}

t.end()
Expand All @@ -81,7 +81,7 @@ test('guess interval - flat data', function (t) {
}, 0, 10)

const interval = guessInterval(data)
t.strictDeepEqual(interval, [0, 8])
t.strictSame(interval, [0, 8])

t.end()
})
12 changes: 6 additions & 6 deletions test/analysis-handles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('analyse handles - no data', function (t) {
const goodHandles = generateProcessStat({
handles: [100]
}, 0)
t.strictEqual(analyseHandles({}, goodHandles, []), 'data')
t.equal(analyseHandles({}, goodHandles, []), 'data')

t.end()
})
Expand All @@ -17,7 +17,7 @@ test('analyse handles - flat', function (t) {
const goodHandles = generateProcessStat({
handles: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
}, 0)
t.strictEqual(analyseHandles({}, goodHandles, []), 'none')
t.equal(analyseHandles({}, goodHandles, []), 'none')

t.end()
})
Expand All @@ -27,7 +27,7 @@ test('analyse handles - symetric data', function (t) {
const goodHandles = generateProcessStat({
handles: [100, 100, 120, 90, 110, 100, 80, 110, 90, 110]
}, noise)
t.strictEqual(analyseHandles({}, goodHandles, []), 'none')
t.equal(analyseHandles({}, goodHandles, []), 'none')
}
t.end()
})
Expand All @@ -45,7 +45,7 @@ test('analyse handles - sawtooth data', function (t) {
100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 100
]
}, noise)
t.strictEqual(analyseHandles({}, badHandles, []), 'performance')
t.equal(analyseHandles({}, badHandles, []), 'performance')
}
t.end()
})
Expand Down Expand Up @@ -74,7 +74,7 @@ test('analyse handles - increasing data', function (t) {
999, 999, 999, 999, 999, 999, 999, 999, 999, 999
]
}, noise)
t.strictEqual(analyseHandles({}, badHandles, []), 'performance')
t.equal(analyseHandles({}, badHandles, []), 'performance')
}
t.end()
})
Expand All @@ -85,7 +85,7 @@ test('analyse handles - almost constant', function (t) {
100, 100, 100, 100, 100, 100, 100, 100, 100,
101, 101, 101, 101, 101, 101, 101, 101, 101]
}, 0)
t.strictEqual(analyseHandles({}, goodHandles, []), 'none')
t.equal(analyseHandles({}, goodHandles, []), 'none')

t.end()
})
2 changes: 1 addition & 1 deletion test/analysis-issue-category.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test('Analysis - issue category', function (t) {
}
const expected = parsed[5]

t.strictEqual(issueCategory(issues), expected, testQuery)
t.equal(issueCategory(issues), expected, testQuery)
}

t.end()
Expand Down
14 changes: 7 additions & 7 deletions test/analysis-memory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('analyse memory - genereate trace event', function (t) {
const gcevents = generateTraceEvent(
'SSSSS.....--MMMMMFC'
)
t.strictDeepEquals(gcevents, [
t.strictSame(gcevents, [
{
pid: 0,
tid: 0,
Expand Down Expand Up @@ -64,7 +64,7 @@ test('analyse memory - no issues', function (t) {
)

for (const nodeVersion of [oldNodeVersion, newNodeVersion]) {
t.strictDeepEquals(analyseMemory({ nodeVersion }, [], gcevents), {
t.strictSame(analyseMemory({ nodeVersion }, [], gcevents), {
external: 'none',
heapTotal: 'none',
heapUsed: 'none',
Expand All @@ -80,7 +80,7 @@ test('analyse memory - no data', function (t) {
)

for (const nodeVersion of [oldNodeVersion, newNodeVersion]) {
t.strictDeepEquals(analyseMemory({ nodeVersion }, [], gcevents), {
t.strictSame(analyseMemory({ nodeVersion }, [], gcevents), {
external: 'none',
heapTotal: 'data',
heapUsed: 'data',
Expand All @@ -96,14 +96,14 @@ test('analyse memory - only old node version has issue', function (t) {
' MMM..-MMM..-MMM..-MMM..-S....-MMM-.-MMM-.-MMM..-FFFF. CCCCC'
)

t.strictDeepEquals(analyseMemory({ nodeVersion: newNodeVersion }, [], gcevents), {
t.strictSame(analyseMemory({ nodeVersion: newNodeVersion }, [], gcevents), {
external: 'none',
heapTotal: 'none',
heapUsed: 'none',
rss: 'none'
})

t.strictDeepEquals(analyseMemory({ nodeVersion: oldNodeVersion }, [], gcevents), {
t.strictSame(analyseMemory({ nodeVersion: oldNodeVersion }, [], gcevents), {
external: 'none',
heapTotal: 'performance',
heapUsed: 'none',
Expand All @@ -119,7 +119,7 @@ test('analyse memory - issue old space', function (t) {
)

for (const nodeVersion of [oldNodeVersion, newNodeVersion]) {
t.strictDeepEquals(analyseMemory({ nodeVersion }, [], gcevents), {
t.strictSame(analyseMemory({ nodeVersion }, [], gcevents), {
external: 'none',
heapTotal: 'performance',
heapUsed: 'none',
Expand All @@ -136,7 +136,7 @@ test('analyse memory - issue with new space', function (t) {
)

for (const nodeVersion of [oldNodeVersion, newNodeVersion]) {
t.strictDeepEquals(analyseMemory({ nodeVersion }, [], gcevents), {
t.strictSame(analyseMemory({ nodeVersion }, [], gcevents), {
external: 'none',
heapTotal: 'none',
heapUsed: 'performance',
Expand Down
12 changes: 6 additions & 6 deletions test/analysis.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getAnalysis (processStatData, traceEventData) {
}

test('Analysis - pipeline - no data', async function (t) {
t.strictDeepEqual(await getAnalysis([], []), {
t.strictSame(await getAnalysis([], []), {
interval: [-Infinity, Infinity],
issues: {
delay: 'data',
Expand All @@ -59,7 +59,7 @@ test('Analysis - pipeline - error', async function (t) {
try {
await getAnalysis([], error)
} catch (e) {
t.strictDeepEqual(e, error)
t.strictSame(e, error)
t.end()
}
})
Expand All @@ -73,7 +73,7 @@ test('Analysis - pipeline - normal interval', async function (t) {
const goodMemoryGC = generateTraceEvent(
'..S..S..........S.........S..S..',
5)
t.strictDeepEqual(await getAnalysis(goodCPU, goodMemoryGC), {
t.strictSame(await getAnalysis(goodCPU, goodMemoryGC), {
interval: [300, 1200],
issues: {
delay: 'none',
Expand All @@ -93,7 +93,7 @@ test('Analysis - pipeline - normal interval', async function (t) {
handles: [3, 3, 3, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 3, 3, 3],
cpu: [1, 1, 1, 50, 40, 10, 10, 100, 50, 40, 10, 10, 10, 1, 1, 1]
}, noise, 10)
t.strictDeepEqual(await getAnalysis(badCPU, goodMemoryGC), {
t.strictSame(await getAnalysis(badCPU, goodMemoryGC), {
interval: [300, 1200],
issues: {
delay: 'none',
Expand Down Expand Up @@ -121,7 +121,7 @@ test('Analysis - pipeline - full interval', async function (t) {
const goodMemoryGC = generateTraceEvent(
'.........S.........',
5)
t.strictDeepEqual(await getAnalysis(goodCPU, goodMemoryGC), {
t.strictSame(await getAnalysis(goodCPU, goodMemoryGC), {
interval: [0, 900],
issues: {
delay: 'none',
Expand All @@ -142,7 +142,7 @@ test('Analysis - pipeline - full interval', async function (t) {
cpu: [50, 40, 10, 10, 100, 50, 40, 10, 10, 10]
}, 0, 10)

t.strictDeepEqual(await getAnalysis(badCPU, goodMemoryGC), {
t.strictSame(await getAnalysis(badCPU, goodMemoryGC), {
interval: [0, 900],
issues: {
delay: 'none',
Expand Down
4 changes: 2 additions & 2 deletions test/cmd-collect-analysing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ test('cmd - test collect - emits "analysing" event', function (t) {
const tool = new ClinicDoctor()

function cleanup (err, dirname) {
t.ifError(err)
t.error(err)
t.match(dirname, /^[0-9]+\.clinic-doctor/)
rimraf(dirname, (err) => {
t.ifError(err)
t.error(err)
t.end()
})
}
Expand Down
Loading

0 comments on commit 9ac80d5

Please sign in to comment.