mirror of
https://github.com/clinicjs/node-clinic.git
synced 2026-01-18 16:22:03 +00:00
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
'use strict'
|
|
|
|
const test = require('tap').test
|
|
const cli = require('./cli.js')
|
|
|
|
test('clinic bubbleprof - should error early if non-node script', function (t) {
|
|
cli({}, ['clinic', 'bubbleprof', '--', 'sh', 'wrapper.sh'], function (err, stdout) {
|
|
t.strictDeepEqual(err, new Error('process exited with exit code 1'))
|
|
t.ok(/Clinic.js BubbleProf[^\w ]/.test(stdout.split('\n')[1]))
|
|
t.end()
|
|
})
|
|
})
|
|
|
|
test('clinic bubbleprof --collect-only - should error early if non-node script', function (t) {
|
|
cli({}, ['clinic', 'bubbleprof', '--collect-only', '--', 'sh', 'wrapper.sh'], function (err, stdout) {
|
|
t.strictDeepEqual(err, new Error('process exited with exit code 1'))
|
|
t.ok(/Clinic.js BubbleProf[^\w ]/.test(stdout.split('\n')[1]))
|
|
t.end()
|
|
})
|
|
})
|
|
|
|
test('clinic bubbleprof - should accept full path to node.js', function (t) {
|
|
cli({}, ['clinic', 'bubbleprof', '--no-open', '--', process.execPath, '-e', 'setTimeout(() => {}, 10)'], function (err, stdout) {
|
|
t.ifError(err)
|
|
t.ok(/Generated HTML file is (.*?)\.clinic[/\\](\d+).clinic-bubbleprof/.test(stdout))
|
|
t.end()
|
|
})
|
|
})
|