使用节点检查器调试Redux Jest测试

时间:2017-11-19 23:31:34

标签: redux jestjs node-inspector

我正在尝试从github repo https://github.com/reactjs/redux/blob/master/test调试Redux Jest测试 使用节点检查器。

node --inspect node_modules/jest/bin/jest.js --runInBand

import { bindActionCreators, createStore } from '../src'
import { todos } from './helpers/reducers'
import * as actionCreators from './helpers/actionCreators'

describe('bindActionCreators', () => {
  let store
  let actionCreatorFunctions

beforeEach(() => {
  debugger;
  store = createStore(todos)
  ...
  ...

但是,如果在测试中放置debugger语句,我会看到以下错误,如上所示。

FAIL  test/bindActionCreators.spec.js
 ● Test suite failed to run

/redux/test/bindActionCreators.spec.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){var _extends = Object.assign || function (target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i];for (var key in source) {if (Object.prototype.hasOwnProperty.call(source, key)) {target[key] = source[key];}}}return target;};import { bindActionCreators, createStore } from '../src';
                                                                                                                                                                                                                                                                                                                                                ^^^^^^

SyntaxError: Unexpected token import

  at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:305:17)
      at Generator.next (<anonymous>)
      at new Promise (<anonymous>)

我正在运行

  • node v8.9.1
  • jest v21.2.1
  • redux master branch

任何想法?

0 个答案:

没有答案