Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Getting Started with Mocha and Chai 3:16
- General Structure of Test Files 4:10
- Setting Up Mocha 4 questions
- Installing Mocha 1 objective
- Installing Chai 1 objective
- Test Suites and Test Specs (describe and it) 3:34
- Mocha Chai Basics 4 questions
- Writing Our First Test Suite 14:49
- Writing Our First Test Suite - Part 2 8:15
- Challenge: Expanding Our Expectations 9:57
- Answer: Expanding Our Expectations 12:05
- A Testing Test! 1 objective
- Assert Your Knowledge 5 questions

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
In this video, you'll learn to write a test suite using the 'describe()' function, and a test spec using the 'it()' function.
Resources
Video review
- A test suite is a block of unit tests that are all closely related; they test the same function or similar parts of our code base
- We introduce a test suite in Mocha using
describe()
- Each individual unit test is sometimes called a “spec”
- Mocha makes it natural to write specs by containing them in a function called
it()
- To use Chai's
expect
method, import Chai at the top of your file:var expect = require('chai').expect
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Amy Tomey
12,847 Points1 Answer
-
Alessandra De Lucas
715 Points4 Answers
-
Fred Young
15,523 Points0 Answers
-
Henry Brenton
10,144 Points0 Answers
-
Dev D
Front End Web Development Techdegree Student 406 Points3 Answers
-
Brian Patterson
19,588 Points2 Answers
-
Alejandro Molina
3,997 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
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