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

Set up Testing Globals in an Application with Jest

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
~ 6 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 Slaars(instructor)
~ 6 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 🙂