Created
October 11, 2018 08:53
-
-
Save dawidnawrot/2b7632f9273d75b41f0cc4e536eb882c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const program = require("commander"); | |
const { spawn } = require('child_process'); | |
program | |
.version("1.0") | |
.description("Test AVA with tags") | |
.name("test:tag") | |
.option("-t, --tags <tags>", "Tags provided with comma") | |
.parse(process.argv); | |
const tags = program.tags.replace(/ /g, '').split(","); | |
let ava = ['ava', '--verbose']; | |
for (var i = 0; i < tags.length; i++) { | |
ava.push("--match"); | |
ava.push("*" + tags[i] + "*"); | |
} | |
const test = spawn('yarn', ava); | |
test.stdout.on('data', data => { | |
console.log(`${data}`); | |
}); | |
test.stderr.on( 'data', data => { | |
console.log(`${data}`); | |
}); | |
test.on('close', code => { | |
console.log(`child process exited with code ${code}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment