Bummer! You have been redirected as the page you requested could not be found.
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!
When we set something up before our tests, we need to be sure we tear it down afterward too. In this video, we’ll use Mocha functions called 'after' and 'afterEach'.
Resources
Video review
- Mocha provides a "teardown" phase to remove unwanted variables
- If your tests change your development environment, like creating a pretend database, or start up a local server, you can use the teardown block to set your system back to where it started
- Mocha's
after()andafterEach()hooks work exactly likebefore()andbeforeEach(), expect that they happen after - If you find yourself depending heavily on the teardown phase, you should double-check that you’re testing the right kind of function
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