如果我删除了nock导入,我将不会收到错误消息。我已经安装了nock
。
import configureMockStore from 'redux-mock-store'
import { promiseHandler } from '../middleware'
import * as actions from './index'
import nock from 'nock'
import expect from 'expect'
const middlewares = [promiseHandler]
const mockStore = configureMockStore(middlewares)
FAIL src/actions/index.test.js
Runtime Error
- TypeError: debug is not a function
at overrideClientRequest (node_modules/nock/lib/intercept.js:221:3)
at activate (node_modules/nock/lib/intercept.js:320:3)
at Object.<anonymous> (node_modules/nock/lib/intercept.js:383:1)
at Runtime._execModule (node_modules/jest-cli/src/Runtime/Runtime.js:261:17)
at Object.<anonymous> (node_modules/nock/lib/recorder.js:6:17)
at Object.<anonymous> (node_modules/nock/index.js:1:135)
at Object.<anonymous> (src/actions/index.test.js:4:39)
at jasmine2 (node_modules/jest-jasmine2/src/index.js:252:16)
at handle (node_modules/worker-farm/lib/child/index.js:41:8)
at process.<anonymous> (node_modules/worker-farm/lib/child/index.js:47:3)
at emitTwo (events.js:100:13)
at process.emit (events.js:185:7)
at handleMessage (internal/child_process.js:718:10)
at Pipe.channel.onread (internal/child_process.js:444:11)
答案 0 :(得分:1)
我不知道我的项目是使用Jest测试框架,
随后,该模块需要“不被嘲笑”#34;在导入之前执行jest.unmock('nock');
。