node-clinic/test/cli-flame-non-node.test.js
Rafael Gonzaga 87e8a215dc
chore: add ci support node 16 (#292)
* 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
2021-10-28 09:41:21 -03:00

29 lines
1.1 KiB
JavaScript

'use strict'
const test = require('tap').test
const cli = require('./cli.js')
test('clinic flame - should error early if non-node script', function (t) {
cli({ relayStderr: false }, ['clinic', 'flame', '--', 'sh', 'wrapper.sh'], function (err, stdout) {
t.strictSame(err, new Error('process exited with exit code 1'))
t.ok(/Clinic.js Flame[^\w ]/.test(stdout.split('\n')[1]))
t.end()
})
})
test('clinic flame --collect-only - should error early if non-node script', function (t) {
cli({ relayStderr: false }, ['clinic', 'flame', '--collect-only', '--', 'sh', 'wrapper.sh'], function (err, stdout) {
t.strictSame(err, new Error('process exited with exit code 1'))
t.ok(/Clinic.js Flame[^\w ]/.test(stdout.split('\n')[1]))
t.end()
})
})
test('clinic flame - should accept full path to node.js', function (t) {
cli({ relayStderr: false }, ['clinic', 'flame', '--no-open', '--', process.execPath, '-e', 'setTimeout(() => {}, 10)'], function (err, stdout) {
t.error(err)
t.ok(/Generated HTML file is (.*?)\.clinic[/\\](\d+).clinic-flame/.test(stdout))
t.end()
})
})