WebStorm configure Mocha to accept command line options

72 Views Asked by At

WebStorm Run-'Edit Configuration' is set up to run Mocha test.

The Mocha Javascript test code accepts nconf command line arguments for e.g. --user='production'

How can 'Edit Configuration' for Mocha test be set up to accept the nconf command line argument?

1

There are 1 best solutions below

0
lena On BEST ANSWER

You can use Extra Mocha Options field for this:

enter image description here

Works fine for me when using the following code:

var nconf = require('nconf');
nconf.argv();

describe("Numbers", function () {
        var foo, json;

        beforeEach(function(){
            foo = nconf.get('foo');
             ...