业力报道(Jasmine,Babel,Webpack)

时间:2016-12-27 14:39:53

标签: karma-jasmine karma-coverage karma-webpack karma-babel-preprocessor

在更改我的karma.conf.js以允许Karma Coverage后,现在运行karma失败。我不确定发生了什么事。有什么想法吗?

process.env.NODE_ENV = 'test';

module.exports = function(config) {
    config.set({
    autoWatch: true,
    browsers: ['Chrome'], //, 'Firefox', 'Safari'],
    frameworks: ['jasmine'],
    logLevel: config.LOG_INFO,
    singleRun: false,
    port: 9876,
    colors: true,
    concurrency: Infinity, // how many browser should be started simultaneous
    files: [
        'test/**/*Spec.js',
        'src/**/*.js' //ADDED FOR COVERAGE
    ],
    preprocessors: {
        'test/**/*Spec.js' : ['babel', 'webpack', 'sourcemap'],
        'src/**/*.js' : ['babel', 'webpack', 'sourcemap', 'coverage'] //ADDED FOR COVERAGE

    },
    reporters: ['progress', 'coverage'], //ADDED FOR COVERAGE
    coverageReporter: { //ADDED FOR COVERAGE
        type : 'html',
        dir : 'coverage/'
    },
    webpack: {
        devtool: 'inline-source-map',
        resolve: {
            extensions: ['', '.js', '.jsx'],
            modulesDirectories: [
                'node_modules'
            ]
        },
        module: {
            loaders: [
                {
                    test: /\.(js|jsx)$/,
                    exclude: /(node_modules)/,
                    loader: 'babel-loader'
                },
                {
                    test: /\.css$/,
                    loader: "style-loader!css-loader"
                }
            ]
        },
        externals: {
            'cheerio': 'window',
            'react/addons': true,
            'react/lib/ExecutionEnvironment': true,
            'react/lib/ReactContext': true
        }
    },
    webpackServer: {
        noInfo: true //don't spam the console when running in karma!
    },

    plugins: [
        "karma-babel-preprocessor",
        "karma-chrome-launcher",
        "karma-webpack",
        "karma-sourcemap-loader",
        "karma-jasmine",
        'karma-coverage'  //ADDED FOR COVERAGE
    ],

    babelPreprocessor: {
        options: {
            presets: [
                "latest",
                "react-app"
            ],
            sourceMap: 'inline',
            plugins: [
                "transform-object-rest-spread"
            ]
        }
    }
})
}

我收到以下错误(以下更多相似内容)

  

27 12 2016 06:35:35.997:ERROR [karma]:{错误:没有这样的文件或目录       在MemoryFileSystem.readFileSync(/Users/lancepoehler/Documents/workspaces/SolarAnalysisClient/node_modules/memory-fs/lib/MemoryFileSystem.js:114:10)       在MemoryFileSystem.readFile(/Users/lancepoehler/Documents/workspaces/SolarAnalysisClient/node_modules/memory-fs/lib/MemoryFileSystem.js:297:21)       at doRead(/Users/lancepoehler/Documents/workspaces/SolarAnalysisClient/node_modules/karma-webpack/lib/karma-webpack.js:201:29)       在Plugin.readFile(/Users/lancepoehler/Documents/workspaces/SolarAnalysisClient/node_modules/karma-webpack/lib/karma-webpack.js:205:5)       at _combinedTickCallback(internal / process / next_tick.js:67:7)       at process._tickCallback(internal / process / next_tick.js:98:9)     代码:'ENOENT',     错误:34,     消息:'没有这样的文件或目录',     路径:'/ _ karma_webpack_/src/components/Error.js'}

0 个答案:

没有答案