1. 25
    Set up Testing Globals in an Application with Jest
    1m 54s

Set up Testing Globals in an Application with Jest

Andy Van Slaars
InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

There are things that will happen in all of our test files that we can handle in a centralized fashion. In this lesson, we’ll create a jest configuration file and a test setup file to import utilities that we want to make available for all of our tests.

Brendan Whiting
Brendan Whiting
~ 2 years ago

FYI now getting deprecation warning:

Option "setupTestFrameworkScriptFile" was replaced by configuration "setupFilesAfterEnv", which supports multiple paths.

This new flag takes an array:

module.exports = {
    setupFilesAfterEnv: ['<rootDir>/testSetup.js']
};
Andy Van Slaars
Andy Van Slaarsinstructor
~ 2 years ago

FYI now getting deprecation warning:

Option "setupTestFrameworkScriptFile" was replaced by configuration "setupFilesAfterEnv", which supports multiple paths.

This new flag takes an array:

module.exports = {
    setupFilesAfterEnv: ['<rootDir>/testSetup.js']
};

This is a change that was made in Jest 24, which was just released 2 days ago. Nice to see useful deprecation messages 🙂