addons
addons copied to clipboard
Server-specific tests should run w/ Jest testEnvironment: 'node'
Uncovered in https://github.com/mozilla/addons-frontend/pull/11593#discussion_r899031000.
Some server-specific tests run w/ Jest's testEnvironment: 'jsdom'
, which is the project's Jest config default.
As a result, some globals are missing or extraneous & test environment is not suited.
This can be solved by either:
- splitting
jsdom
&node
test environments w/ their own test command - using
testEnvironment: 'node'
by default, and using the@jest-environment jsdom
docblock when needed - keeping
testEnvironment: 'jsdom'
by default, and using the@jest-environment node
docblock when needed
See also:
- https://testing-library.com/docs/react-testing-library/setup#jest-28
- https://jestjs.io/docs/configuration#testenvironment-string
┆Issue is synchronized with this Jira Task
Old Jira Ticket: https://mozilla-hub.atlassian.net/browse/ADDFRNT-84