dangerouslyRenderMarkup(...):无法在工作线程中呈现标记

时间:2016-08-24 16:59:33

标签: unit-testing testing reactjs mocha jsdom

我看到了类似问题的另一个问题,但他们的解决方案在我的案例中不起作用。我有正确的js-dom设置:

const jsdom = require('jsdom').jsdom; // could throw
const exposedProperties = ['window', 'navigator', 'document'];
global.document = jsdom('');
global.window = document.defaultView;
Object.keys(document.defaultView).forEach((property) => {
if (typeof global[property] === 'undefined') {
  exposedProperties.push(property);
  global[property] = document.defaultView[property];
}
});

并在我的npm测试启动中的所有其他文件之前要求此文件

"scripts": {
      "test": "mocha --require mock-local-storage  ./src/test_helper.js --compilers js:babel-core/register,css:excluders_for_mocha_tests.js --recursive ./src/**/__test__/*_test.js --watch"
   }

但这对我没有帮助。有趣的说明:我第一次启动测试时没有错误但是在第一次保存后出现28个错误......

我读到的信息是,在需要test-helper之前,jasmine可以使用测试代码。也许摩卡也差不多?

0 个答案:

没有答案