Skip to content

Instantly share code, notes, and snippets.

@dawidnawrot
Created October 11, 2018 08:53
Show Gist options
  • Save dawidnawrot/2b7632f9273d75b41f0cc4e536eb882c to your computer and use it in GitHub Desktop.
Save dawidnawrot/2b7632f9273d75b41f0cc4e536eb882c to your computer and use it in GitHub Desktop.
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