Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack 需要使用网页包设置Karma的帮助-无法加载文件_Webpack_Karma Jasmine - Fatal编程技术网

Webpack 需要使用网页包设置Karma的帮助-无法加载文件

Webpack 需要使用网页包设置Karma的帮助-无法加载文件,webpack,karma-jasmine,Webpack,Karma Jasmine,网页1.3.1 巴别塔5.8.35 Barma 1.1.2 第一次设置时,我的一些文件没有被加载,看起来它们中有某种错误,但我无法准确地找出原因,因为我在输出中没有收到错误消息。 老实说,我不确定我是否做对了,这是我的因果报应: const webpack = require('webpack'); const webpackConfig = require('../tools/webpack.config.babel'); const RewirePlugin = require("rewir

网页1.3.1
巴别塔5.8.35
Barma 1.1.2

第一次设置时,我的一些文件没有被加载,看起来它们中有某种错误,但我无法准确地找出原因,因为我在输出中没有收到错误消息。
老实说,我不确定我是否做对了,这是我的因果报应:

const webpack = require('webpack');
const webpackConfig = require('../tools/webpack.config.babel');
const RewirePlugin = require("rewire-webpack");
const path = require('path');
const argv = require('minimist')(process.argv.slice(2));
const RELEASE = !!argv.release;
const DEBUG = !!argv.debug;
const BROWSERS = argv.browsers;

module.exports = function(config) {
    function getReporters() {
        return ['junit', 'progress'];
    }

    function getBrowsers() {
        let browsers = ['PhantomJS'];
        if (BROWSERS) {
            return BROWSERS.split(',');
        }
        if (RELEASE) {
            browsers = ['Chrome', 'Firefox', 'IE'];
        } else if (DEBUG) {
            browsers = ['Chrome'];
        }
        return browsers;
    }

    function getFiles() {
        let files = [
            'node_modules/jquery/dist/jquery.js',
            'node_modules/jquery-ui/js/jquery-ui.js',
            'test/tests.jsx'
        ];
        return files;
    }

    function getPreprocessors() {
        return {
            'test/tests.jsx': ['webpack', 'sourcemap'],
            'src/**/*(js|jsx)': ['webpack', 'sourcemap']
        };
    }
    function configureWebpackConfig() {
        webpackConfig.plugins = [];
        webpackConfig.plugins.push(new RewirePlugin());
        webpackConfig.devtool = 'inline-source-map';
        return webpackConfig;
    }
    config.set({

        basePath: path.join(__dirname, '../'),

        files: getFiles(),

        singleRun: false,

        preprocessors: getPreprocessors(),

        webpack: configureWebpackConfig(),

        webpackServer: {
            stats: {
                colors: true
            }
        },

        webpackMiddleware: {
            // webpack-dev-middleware configuration
            // i. e.
            noInfo: true
        },

        browserNoActivityTimeout: 1000000,

        // coverage reporter generates the coverage
        reporters: ['junit', 'progress'],

        autoWatch: false,

        frameworks: [
            'jasmine',
            'jasmine-matchers'
        ],

        browsers: getBrowsers(),

        plugins: [
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-phantomjs-launcher-nonet',
            'karma-ie-launcher',
            'karma-jasmine',
            'karma-jasmine-matchers',
            'karma-webpack',
            'karma-junit-reporter',
            'karma-sourcemap-loader'
        ],

        customLaunchers: {
            IE11: {
                base: 'IE',
                'x-ua-compatible': "IE=EmulateIE11"
            }
        },

        phantomjsLauncher: {
            cmd: {
                win32: path.join(__dirname, '../node_modules/phantomjs/lib/phantom/bin/phantomjs.exe')
            }
        }
    });
};
我的目录结构:

项目
|
└───节点单元
│
└───src
│    │   jsx文件
│    |
│    ├─── __测验__
│    │   │   测试文件
│    │   │   ...
│    │
└───测试
|    │   tests.jsx
│    │
│    │
└───配置
|    |
|| karma.js
mytests.jsx

const testsContext = require.context("../src", true, /^.*\.(spec|integration-spec)$/);
console.log('found ' + testsContext.keys().length + " tests");
testsContext.keys().forEach(function(k) {
    console.log('executing ' + k + " test");
    console.log(testsContext);
    testsContext(k);
});
module.exports = testsContext;
我能够确定其中哪些不是正确需要的,但我无法找出原因。这就是我得到的:

PhantomJS 2.1.1(Windows 7 0.0.0):执行0/0错误(0.004秒/ 0秒)