jest单测知多少
jestmock一个不存在的文件const { myFunc } = require('does not exist')jest.mock('does not exist', () => ({ myFunc: () => 'hello', obj: {} }), { virtual: true });test('mock file that does not exist', () => { expect(myFunc()).toBe('hello')
原创
2021-11-09 18:22:37 ·
1110 阅读 ·
0 评论