Unit Testing in JavaScript: Exploring & Configuring the Mocha Testing Framework


Overview/Description
Expected Duration
Lesson Objectives
Course Number
Expertise Level



Overview/Description

Explore how to use JS (Javascript) Mocha, the most popular unit testing framework to run unit tests, in this 13-video course, which examines different hooks that Mocha.js provides to run the test suites. First, learners will examine specific testing environments using the Mocha before and beforeEach hooks. You will then learn how to tear down these test environments, after the completion of the tests, by using the after and afterEach hooks. You will learn how to write tests for asynchronous functions by using the done method, and how to use Async awake keywords. You will learn to use the async/await methods to test asynchronous code that return promises. This course then demonstrates how to set up a simple HTTP server to run Mocha tests in a browser environment. Finally, you will learn how to use the Mocha command line to run multiple tests and how to select a specific test to run by using regular expressions.



Expected Duration (hours)
1.2

Lesson Objectives

Unit Testing in JavaScript: Exploring & Configuring the Mocha Testing Framework

  • discover the key concepts covered in this course
  • recognize the use of the before() and after() hooks in tests
  • recognize the use of the beforeEach() and afterEach() hooks in tests
  • implement tests using multiple hooks
  • recall why the use of the arrow functions should be avoided in Mocha
  • use the done() method to signal test completion
  • set up asynchronous test functions
  • perform asynchronous testing using async/await
  • prepare Mocha tests to run within a browser
  • run Mocha tests in a browser
  • configure different reporters in Mocha
  • run multiple tests from the command line
  • summarize the key concepts covered in this course
  • Course Number:
    it_aputjsdj_03_enus

    Expertise Level
    Intermediate