vnx*_*xyz 6 unit-testing mocking reactjs jestjs
请检查以下场景
const url = 'https://mock.com/mockpath';
jest.mock('../../src/somefile', () => {
return ({
getURL: jest.fn(() => url),
});
});
Run Code Online (Sandbox Code Playgroud)
我收到错误
babel-plugin-jest-hoist: The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables.
Invalid variable access: url
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9954 次 |
| 最近记录: |