Skip to content
RED SAG Skills
hard20 pts · first answer countstest-automationjesttest-doubles

A jest.mock factory error

Jest throws "The module factory of jest.mock() is not allowed to reference any out-of-scope variables". Why?

import { getRate } from './rates'
const fakeRate = 22.85
jest.mock('./rates', () => ({ getRate: () => fakeRate }))
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions