Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Use mocha to automatically run all the tests in tests.js.

Use mocha to automatically run all the tests in tests.js.

I can not find the appropriate command to run this test ?

7 Answers

mocha will run the tests in the specified file or directory that follows it, so the answer should be "mocha tests.js"

I've tested it and the challenge accepts what I wrote. (without quote marks, of course)

Right answer

mocha tests.js

Test is plural so check your typing, I took me a bit to realize it's "tests" not "test"

ok

You could automate it. Here's how:

  • In your ~/.bash_profile

    alias automocha="supervisor -q -n exit -x mocha -- -b"
    
  • install mocha & supervisor globally(optional - you can just install them locally to your project as devDependencies)

    $ npm install -g supervisor mocha
    

when you run automocha on your project. It will automatically invoke mocha every time a file changes.

mocha tests.js

This worked for me

mocha -g tests.js