Skip to content

Commit

Permalink
Add support for passing flags to Mocha
Browse files Browse the repository at this point in the history
Update argv parsing to ignore flags passed to mocha. Without
this, enabling the Node.js debugger breaks Nodal's testing
framework.
  • Loading branch information
William J Blankenship committed Sep 8, 2021
1 parent 582f2c5 commit 2edad66
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/mocha/test_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ class TestRunner {
tests() {

let tests = [];
let filter;
// Strip mocha and node flags out before looking for filter
let filter = process.argv.filter(str => !str.startsWith('--')).slice(3)[0]

if (process.argv.length > 3) {
filter = process.argv[3];

if (filter) {
filter = filter.endsWith('.js') ? filter : `${filter}.js`;
}

Expand Down

0 comments on commit 2edad66

Please sign in to comment.