Skip to content

Commit

Permalink
feat: wrap tests running in command
Browse files Browse the repository at this point in the history
  • Loading branch information
rostik404 committed Mar 15, 2018
1 parent 7b7ea71 commit fcbd8bf
Show file tree
Hide file tree
Showing 4 changed files with 1,098 additions and 588 deletions.
32 changes: 17 additions & 15 deletions lib/cli/index.js
Expand Up @@ -31,25 +31,27 @@ exports.run = () => {
.option('-s, --set <set>', 'run tests only in the specified set', collect)
.option('--grep <grep>', 'run only tests matching the pattern')
.option('--update-refs', 'update screenshot references or gather them if they do not exist ("assertView" command)')
.arguments('[paths...]');
.arguments('[paths...]')
.action(async (paths) => {
try {
const isTestsSuccess = await hermione.run(paths, {
reporters: program.reporter || defaults.reporters,
browsers: program.browser,
sets: program.set,
grep: program.grep,
updateRefs: program.updateRefs
});

process.exit(isTestsSuccess ? 0 : 1);
} catch (err) {
logger.error(err.stack || err);
process.exit(1);
}
});

hermione.extendCli(program);

program.parse(process.argv);

return hermione
.run(program.args, {
reporters: program.reporter || defaults.reporters,
browsers: program.browser,
sets: program.set,
grep: program.grep,
updateRefs: program.updateRefs
})
.then((success) => process.exit(success ? 0 : 1))
.catch((err) => {
logger.error(err.stack || err);
process.exit(1);
});
};

function collect(newValue, array = []) {
Expand Down

0 comments on commit fcbd8bf

Please sign in to comment.