0
1) test "before all" hook:
 (SystemJS) ToMyIds is not a function
    TypeError: ToMyIds is not a function
        at execute (C:/Users/cpatton/Documents/myApp/client/app/view/map/map.jsx!transpiled:59:50)
    Error loading C:/Users/cpatton/Documents/myApp/client/app/view/enhancers/to-my-ids.jsx

目前,我所有的 mocha 测试失败都与转译的行号/列号一起输出。有没有一种方便的方法可以使用我的源图获得摩卡咖啡?

这是我当前的测试入口点:

require('systemjs');
require('./jspm.config');
require('babel-register');
require('babel-polyfill');

const jsdom = require('jsdom');
const Mocha = require('mocha');
const glob = require('glob');
const mocha = new Mocha();
const sinon = require('sinon');

// Bug Fix <?>: https://github.com/airbnb/enzyme/issues/58#issuecomment-162514956
global.document = jsdom.jsdom('');
global.window = document.defaultView;
global.navigator = window.navigator;
global.XMLHttpRequest = sinon.useFakeXMLHttpRequest();

glob('@(app|test)/**/*.spec.js?(x)', (err, files) => {
  let file;
  if (err) {
    throw err;
  }
  for (let i = 0, len = files.length; i < len; i++) {
    file = files[i];
    mocha.addFile(file);
  }
  mocha.ui('bdd');
  mocha.timeout(0);
  // mocha.reporter('min'); // My personal preference for debugging
  return mocha.run((failures) => {
    return process.exit(failures);
  });
});

我相信这与Babel + Mocha 堆栈跟踪报告错误的行号不同,因为堆栈跟踪实际上包括它的转译步骤,如!transpiled所示,如果包含,retainLines 什么也不做:

require('babel-register')({
  retainLines: true,
});
4

0 回答 0