不使用jest runner时导入jest对象

问题描述 投票:1回答:1

当我没有用jest运行我的代码时,我需要导入/要求什么才能访问包含jest object的魔法jest.fn

jestjs
1个回答
2
投票

Jest现在单独出口jest-mock包(https://github.com/facebook/jest/tree/master/packages/jest-mock)。

import jestMock from 'jest-mock';
const mockFunction = jestMock.fn();
© www.soinside.com 2019 - 2024. All rights reserved.