When calling truffle test some_test.js, I would like to pass Mocha switches.

For example: truffle --no-colors test some_test.js works fine.

However: truffle --reporter json-streams test some_test.js doesn't.

To my understanding, it should get Mocha to generate all the output in JSON format.

Any ideas?


I can do it by adding this to the Truffle configuration file (truffle.js or truffle-config.js):

mocha: {
    useColors: false,
    reporter: "json"

Available reporters are described here.

  • But this is restricted to general configuration. What if a I want to use some mocha settings for my dev environment but others for CI? – jmendiola Aug 5 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.