mirror of
https://github.com/clinicjs/node-clinic.git
synced 2025-12-08 21:26:08 +00:00
* chore: bump tap version * chore: add v16 to test matrix * chore: update coverage settings to latest tap version * chore: use taprc * chore: support v17 * chore: updade coverage settings
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
'use strict'
|
|
|
|
const test = require('tap').test
|
|
const cli = require('./cli.js')
|
|
|
|
test('clinic heapprofiler - should error early if non-node script', function (t) {
|
|
cli({ relayStderr: false }, ['clinic', 'heapprofiler', '--', 'sh', 'wrapper.sh'], function (err, stdout) {
|
|
t.strictSame(err, new Error('process exited with exit code 1'))
|
|
t.ok(/Clinic.js Heap Profiler[^\w ]/.test(stdout.split('\n')[1]))
|
|
t.end()
|
|
})
|
|
})
|
|
|
|
test('clinic heapprofiler --collect-only - should error early if non-node script', function (t) {
|
|
cli(
|
|
{ relayStderr: false },
|
|
['clinic', 'heapprofiler', '--collect-only', '--', 'sh', 'wrapper.sh'],
|
|
function (err, stdout) {
|
|
t.strictSame(err, new Error('process exited with exit code 1'))
|
|
t.ok(/Clinic.js Heap Profiler[^\w ]/.test(stdout.split('\n')[1]))
|
|
t.end()
|
|
}
|
|
)
|
|
})
|
|
|
|
test('clinic heapprofiler - should accept full path to node.js', function (t) {
|
|
cli(
|
|
{ relayStderr: false },
|
|
['clinic', 'heapprofiler', '--no-open', '--', process.execPath, '-e', 'setTimeout(() => {}, 10)'],
|
|
function (err, stdout) {
|
|
t.error(err)
|
|
t.ok(/Generated HTML file is (.*?)\.clinic[/\\](\d+).clinic-heapprofile/.test(stdout))
|
|
t.end()
|
|
}
|
|
)
|
|
})
|