因果报应+;PhantomJS-未定义窗口

因果报应+;PhantomJS-未定义窗口,phantomjs,karma-runner,karma-mocha,Phantomjs,Karma Runner,Karma Mocha,我正在使用Karma和PhantomJS作为无头浏览器。由于某些原因,我不断收到一个错误,说未定义窗口。 我的karma.conf.js var path = require('path'); var webpack = require('webpack'); var webpackConfig = require('./config/webpack/webpack.config'); webpackConfig.module = { loaders: [ { test

我正在使用Karma和PhantomJS作为无头浏览器。由于某些原因,我不断收到一个错误,说未定义窗口。

我的karma.conf.js

var path = require('path');
var webpack = require('webpack');
var webpackConfig = require('./config/webpack/webpack.config');

webpackConfig.module = {
  loaders: [
    {
      test: /\.js$/,
      loader: 'babel',
      include: path.join(__dirname, 'app/frontend')
    },
    { test: /\.json$/, loader: 'json-loader' },
    { test: /\.css$/, loader: 'style!css?modules&importLoaders=1&localIdentName=[name]__[local]' },
    { test: /\.scss$/, loader: 'style!css?modules&importLoaders=1&localIdentName=[name]__[local]!resolve-url!sass?outputStyle=expanded' },
    { test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' } // inline base64 URLs for <=8k images, direct URLs for the rest
  ],
  noParse: [
    /node_modules\/sinon\//
  ]
};

  module.exports = function (config) {
    config.set({
    browsers: [ 'PhantomJS' ],
    singleRun: true, //just run once by default
    frameworks: [ 'mocha' ], //use the mocha test framework
    files: [
    'app/frontend/.config/karma/test.bundle.js' //just load this file
    ],
    preprocessors: {
      'app/frontend/.config/karma/test.bundle.js': [ 'webpack',   'sourcemap' ] //preprocess with webpack and our sourcemap loader
    },
    reporters: [ 'dots' ], //report results in this format
    webpack: webpackConfig,
    colors: true,
    webpackServer: {
    noInfo: true
    },
    phantomjsLauncher: {
      exitOnResourceError: true
    }
  });
};
var path=require('path');
var webpack=require('webpack');
var webpackConfig=require('./config/webpack/webpack.config');
webpackConfig.module={
装载机:[
{
测试:/\.js$/,,
加载器:“巴贝尔”,
包括:path.join(uu dirname,'app/frontend')
},
{test://\.json$/,loader:'json loader'},
{test://\.css$/,loader:'style!css?modules&importLoaders=1&localIdentName=[name]\uuuuu[local]},
{test:/\.scss$/,loader:'style!css?modules&importLoaders=1&localIdentName=[name]\uuuuuu[local]!resolve url!sass?outputStyle=expanded'},

{test://\(png | jpg)$/,loader:'url loader?limit=8192'}//内联base64 url,您曾经解决过这个问题吗?