如果我删除 nock 导入,我不会收到错误消息。我已经安装了 npm 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)