-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
type: buga defect, confirmed by a maintainera defect, confirmed by a maintainer
Description
Description
The current code silently ignores any problems parsing the options file and continues on.
Lines 32 to 47 in 99c2f8a
| try { | |
| const opts = fs | |
| .readFileSync(optsPath, 'utf8') | |
| .replace(/\\\s/g, '%20') | |
| .split(/\s/) | |
| .filter(Boolean) | |
| .map(value => value.replace(/%20/g, ' ')); | |
| process.argv = process.argv | |
| .slice(0, 2) | |
| .concat(opts.concat(process.argv.slice(2))); | |
| } catch (err) { | |
| // ignore | |
| } | |
| process.env.LOADED_MOCHA_OPTS = true; |
Code should instead throw an error for any error encountered, except for a nonexistent default options file (i.e., user did not specify --opts and "test/mocha.opts" does not exist).
Downside?
People who have errors in their "mocha.opts" file will experience failures until corrected.
Metadata
Metadata
Assignees
Labels
type: buga defect, confirmed by a maintainera defect, confirmed by a maintainer