fix: --watch for testing

This commit is contained in:
cha0s 2021-03-21 19:03:42 -05:00
parent 8423867474
commit d4fd51b26d

View File

@ -171,13 +171,18 @@ program
const test = async () => {
process.argv.splice(2, 1);
const watchIndex = process.argv.indexOf('--watch');
if (-1 !== watchIndex) {
process.argv.splice(watchIndex, 1);
}
await build(['--display', 'none']);
spawn(
'mocha',
[
'--colors',
'test.js',
],
(-1 === watchIndex ? [] : ['--watch'])
.concat([
'--colors',
'test.js',
]),
{
env: {
NODE_PATH: './node_modules',
@ -190,6 +195,7 @@ const test = async () => {
program
.command('test')
.allowUnknownOption()
.description('build and run tests')
.action(test);