Skip to content

Commit

Permalink
Convert all arrays to comma separated lists for Mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 7, 2017
1 parent fbcaf85 commit 12d44db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ module.exports = opts => {
suppress: false
}, opts);

if (Array.isArray(opts.globals)) {
// `globals` option should end up as a comma-separated list
opts.globals = opts.globals.join(',');
// Convert arrays into comma separated lists
for (const key of Object.keys(opts)) {
const val = opts[key];

if (Array.isArray(val)) {
opts[key] = val.join(',');
}
}

const args = dargs(opts, {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gulp.task('default', () =>

#### options

Options are passed directly to the `mocha` binary, so you can use any its [command-line options](http://mochajs.org/#usage) in a camelCased form. Listed below are some of the more commonly used options:
Options are passed directly to the `mocha` binary, so you can use any its [command-line options](http://mochajs.org/#usage) in a camelCased form. Arrays are correctly converted to the comma separated list format Mocha expects. Listed below are some of the more commonly used options:


##### ui
Expand Down

0 comments on commit 12d44db

Please sign in to comment.