Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Fixtures are the part of a test suite that set the stage for our specs. In this video, we’ll write code to run before every spec and also before each test spec that makes testing simpler.
Resources
Video review
- Mocha provides useful functions to help us set up conditions for our tests, like creating test objects and simulating the conditions inside our app
- The "setup" phase is the part of our tests where we set up conditions for testing
- Mocha splits the setup process into two blocks: the stuff we set up before the entire series of tests, and the stuff we set up before each individual test
- Mocha provides the hooks
before()
,after()
,beforeEach()
, andafterEach()
to set up preconditions and clean up after your tests -
beforeEach()
works like before, only it will run the function before each spec, instead of just once at the start of the suite
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
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