blob: 2f1f693f2df4dd4d65476d4a033ee7f874c10fe5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
const t = require('tap')
const LifecycleCmd = require('../../../lib/utils/lifecycle-cmd.js')
let runArgs = null
const npm = {
commands: {
'run-script': (args, cb) => {
runArgs = args
cb(null, 'called npm.commands.run')
},
},
}
t.test('create a lifecycle command', t => {
const cmd = new LifecycleCmd(npm, 'test-stage')
t.match(cmd.usage, /test-stage/)
cmd.exec(['some', 'args'], (er, result) => {
t.same(runArgs, ['test-stage', 'some', 'args'])
t.strictSame(result, 'called npm.commands.run')
t.end()
})
})
|