Skip to content

Commit

Permalink
feat: add support for the mocha --invert flag (#622)
Browse files Browse the repository at this point in the history
* feat: add support for the mocha --invert flag

* fix: pass invert to karma mocha config
  • Loading branch information
jacobheun authored Aug 11, 2020
1 parent beedcdb commit 964d05f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const karmaConfig = (config, argv) => {
reporter: 'spec',
timeout: argv.timeout ? Number(argv.timeout) : 5000,
bail: argv.bail,
grep: argv.grep
grep: argv.grep,
invert: argv.invert
}

const karmaEntry = `${__dirname}/karma-entry.js`
Expand Down
2 changes: 2 additions & 0 deletions src/test/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = (argv, execaOptions) => {
const files = argv.files ? ['--files-custom', ...argv.files] : []
const verbose = argv.verbose ? ['--log-level', 'debug'] : ['--log-level', 'error']
const grep = argv.grep ? ['--grep', argv.grep] : []
const invert = argv.invert ? ['--invert'] : []
const progress = argv.progress ? ['--progress', argv.progress] : []
const bail = argv.bail ? ['--bail', argv.bail] : []
const timeout = argv.timeout ? ['--timeout', argv.timeout] : []
Expand All @@ -27,6 +28,7 @@ module.exports = (argv, execaOptions) => {
...files,
...verbose,
...grep,
...invert,
...progress,
...input,
...bail,
Expand Down
2 changes: 2 additions & 0 deletions src/test/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = (argv) => {
const files = argv.files.length ? [...argv.files] : ['test/**/*.spec.{js,ts}']
const verbose = argv.verbose ? ['--log-level', 'debug'] : ['--log-level', 'error']
const grep = argv.grep ? ['--grep', argv.grep] : []
const invert = argv.invert ? ['--invert'] : []
const progress = argv.progress ? ['--reporter=progress'] : []
const bail = argv.bail ? ['--bail', argv.bail] : []
const timeout = argv.timeout ? ['--timeout', argv.bail] : []
Expand All @@ -25,6 +26,7 @@ module.exports = (argv) => {
...watch,
...verbose,
...grep,
...invert,
...progress,
...bail,
...timeout,
Expand Down
4 changes: 4 additions & 0 deletions src/test/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function testNode (ctx, execaOptions) {
args.push(`--grep=${ctx.grep}`)
}

if (ctx.invert) {
args.push('--invert')
}

if (ctx.files && ctx.files.length > 0) {
files = ctx.files
}
Expand Down

0 comments on commit 964d05f

Please sign in to comment.