简体   繁体   English

Wallabyjs-不断收到TypeError:'undefined'

[英]Wallabyjs - keep getting TypeError: 'undefined'

I'm trying to use wallaby config similar to this example , and I keep getting the following error: 我正在尝试使用类似于本示例的 wallaby config,并且不断出现以下错误:

TypeError: 'undefined' is not an object (evaluating 'window.__moduleBundler.loadTests') TypeError:“未定义”不是对象(正在评估“ window .__ moduleBundler.loadTests”)

My wallabyjs: 我的wallabyjs:

var wallabyWebpack = require('wallaby-webpack');

module.exports = function (wallaby) {

  var webpackPostprocessor = wallabyWebpack({
    // webpack options

    externals: {
      // Use external version of React instead of rebuilding it
      "react": "React"
    },
    resolve: {
      extensions: ['', '.js', '.jsx']
    }
  });

  return {
    files: [
      //not required if using PhantomJs2 - http://wallabyjs.com/docs/integration/phantomjs2.html
      {pattern: 'node_modules/phantomjs-polyfill/bind-polyfill.js', instrument: false},
      {pattern: 'node_modules/react/dist/react-with-addons.js', instrument: false},

      {pattern: 'app/**/*.js*', load: false}
    ],

    tests: [
      {pattern: 'app/**/*.spec.js*', load: false}
    ],

    compilers: {
      '**/*.js*': wallaby.compilers.babel()
    },

    postprocessor: webpackPostprocessor,

    bootstrap: function () {
      window.__moduleBundler.loadTests();
    },

    debug: true

  };
};

My package.json : 我的package.json

{
  "name": "react-example",
  "version": "0.0.0",
  "description": "",
  "scripts": {
    "start": "web-build start",
    "build": "web-build build",
    "test": "web-build test",
    "unit": "web-build unit",
    "e2e": "wix-web-build e2e",
    "release": ":"
  },
  "repository": {
    "type": "git",
    "url": "---"
  },
  "keywords": [
    "react",
    "example"
  ],
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "babel-core": "^6.9.1",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-react": "^6.5.0",
    "babel-preset-stage-0": "^6.5.0",
    "expect": "^1.18.0",
    "petri-specs": "^1.0.0",
    "phantomjs-polyfill": "0.0.2",
    "react-addons-test-utils": "^0.14.8",
    "wallaby-webpack": "0.0.22"
  },
  "dependencies": {
    "react": "^0.14.7",
    "react-dom": "^0.14.7",
    "react-redux": "^4.4.5",
    "redux": "^3.5.2"
  },
  "private": true
}

What am I doing wrong?? 我究竟做错了什么??

Answering my own question: I debugged my code using debug: true and found out I did not have webpack installed. 回答我自己的问题:我使用debug: true调试了我的代码,发现我没有安装webpack。 So, npm install webpack --save-dev solved this issue. 因此, npm install webpack --save-dev解决了此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 继续获取TypeError返回为未定义 - Keep getting TypeError that comes back as undefined 我一直得到TypeError:undefined不是一个函数 - I keep getting TypeError: undefined is not a function 不断收到“类型错误:无法设置未定义的属性‘1’” - Keep Getting "TypeError: Cannot set property '1' of undefined" 我不断收到类型错误:无法读取未定义的属性“缓存” - I keep getting the TypeError: Cannot read property 'cache' of undefined 我不断收到此类型错误:无法读取未定义的属性“地图” - I keep getting this TypeError: Cannot read property 'map' of undefined 不断收到TypeError:无法读取未定义的属性'formatted_address' - Keep getting TypeError: Cannot read property 'formatted_address' of undefined 为什么我在angularJS中一直得到undefined的TypeError设置属性? - Why I keep getting TypeError setting property of undefined in angularJS? 获取JavaScript未定义的TypeError - Getting javascript undefined TypeError 保持不确定 - Keep getting undefined 不断收到TypeError:当我单击复选框时无法读取未定义的属性“地图”,不知道问题出在哪里 - Keep getting TypeError: Cannot read property 'map' of undefined when I click on checkbox, dont know where the problem is
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM