Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Unit Testing!
You have completed JavaScript Unit Testing!
Preview
In this video, we’ll go over the specific way Mocha expects us to organize our files in order to run properly.
Related workshop
- Using npm as a Task Runner – Learn how to customize your package.json file
Video review
- It’s important that the test directory is specifically named "test" (not "tests" or "Test"), and it has to be located at the same level of your project as the package.json file
- With your test directory in place, you simply run
npm test, and Mocha will automatically run every test in the test directory
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
The main issue is that we don't want
to track down our test files manually
0:00
every time we run them.
0:02
The whole point of automated testing
is that our tests are easier and
0:04
better to use than our
old manual testing style.
0:07
If our tests are annoying to use then
we might go through all the trouble of
0:11
writing them only to never actually
run them while we're developing.
0:14
That would be a huge waste.
0:18
So, we want our test to be easy to run and
0:20
write that way we're more likely
to actually test our code.
0:22
>> Mocha has a really convenient feature.
0:27
Since we've already installed
Mocha as a dependency for
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up