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

Unit Testing    |    Intermediate
  • 13 videos | 1h 9m 18s
  • Includes Assessment
  • Earns a Badge
Rating 5.0 of 5 users Rating 5.0 of 5 users (5)
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.

WHAT YOU WILL LEARN

  • 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

IN THIS COURSE

  • 2m 4s
  • 10m 10s
    Upon completion of this video, you will be able to recognize the use of the before and after hooks in tests. FREE ACCESS
  • Locked
    3.  Before Each and After Each Hooks
    3m 57s
    Upon completion of this video, you will be able to recognize the use of the beforeEach() and afterEach() hooks in tests. FREE ACCESS
  • Locked
    4.  Bringing All Hooks Together
    4m 55s
    In this video, you will learn how to implement tests using multiple test hooks. FREE ACCESS
  • Locked
    5.  Arrow Functions for Mocha Tests
    6m 7s
    Upon completion of this video, you will be able to recall why the use of arrow functions should be avoided in Mocha. FREE ACCESS
  • Locked
    6.  Asynchronous Testing Using Done
    7m 8s
    Find out how to use the done() method to signal the completion of a test. FREE ACCESS
  • Locked
    7.  Setting up Async Utilities
    4m 51s
    In this video, you will learn how to set up asynchronous test functions. FREE ACCESS
  • Locked
    8.  Asynchronous Testing Using Async/Await
    6m 34s
    In this video, learn how to perform asynchronous testing using the async/await keywords. FREE ACCESS
  • Locked
    9.  Setting up Mocha Tests in the Browser
    8m 12s
    Find out how to prepare Mocha tests to run in a browser. FREE ACCESS
  • Locked
    10.  Running Mocha Tests in the Browser
    4m 29s
    Learn how to run Mocha tests in a browser. FREE ACCESS
  • Locked
    11.  Configuring Mocha Reporters
    3m 40s
    Find out how to configure different reporters in Mocha. FREE ACCESS
  • Locked
    12.  Running Multiple Tests
    5m 58s
    In this video, you will run multiple tests from the command line. FREE ACCESS
  • Locked
    13.  Course Summary
    1m 12s
    In this video, we will summarize the key concepts covered in this course. FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 305 users Rating 4.5 of 305 users (305)
Rating 4.4 of 1166 users Rating 4.4 of 1166 users (1166)
Rating 4.8 of 21 users Rating 4.8 of 21 users (21)