karma-typescript \ node_modules \ remap-istanbul \ utils \ node.js'不是加载程序(必须具有正常或音调功能)

时间:2018-07-05 21:12:49

标签: typescript webpack karma-runner

当我尝试运行代码时,我收到此问题:

..\karma-typescript\node_modules\remap-istanbul\utils\node.js' is not a loader (must have normal or pitch function)

我在这里使用Webpack 3,Typescript和Karma。 这是我的Karma配置文件的代码:

var webpack = require('../webpack.config.test.js');
process.env.CHROME_BIN = require('puppeteer').executablePath();
// webpackConfig.entry = null;
module.exports = function (config) {
    config.set({
        frameworks: ['mocha', 'karma-typescript'],`
        ` files: [`
            `./index.ts'`
        `],`

        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        preprocessors: {
            // add webpack as preprocessor
            './index.ts': ['webpack', 'sourcemap'],
        },
        webpack: webpack,
        webpackMiddleware: {
            noInfo: true
        },

        // list of files to exclude
        exclude: [],

        // test results reporter to use
        // possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        reporters: ['spec','karma-remap-istanbul'],

        // web server port
        port: 8080,
        colors: true,

        // level of logging
        // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
        logLevel: config.LOG_ERROR,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: true,

        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        browsers: ['Chrome'],
        reporters: ['spec', 'coverage'],
        coverageReporter: {

            dir: 'build/coverage/',
            reporters: [{
                    type: 'html'
                },
                {
                    type: 'text'
                },
                {
                    type: 'text-summary'
                }
            ]
        },

        // // Continuous Integration mode
        // // if true, Karma captures browsers, runs the tests and exits
        // singleRun: false,

        // Concurrency level
        // how many browser should be started simultaneous
        concurrency: 1,
        plugins: [
            require('karma-webpack'),
            require('karma-mocha'),
            require('karma-chai'),
            require('karma-chrome-launcher'),
            require('karma-typescript'),
            require('karma-sourcemap-loader'),
            require('karma-spec-reporter'),
            require('karma-jasmine'),
            require('karma-coverage'),
        ],
    })
};`

有人对如何解决此问题有任何想法吗?

0 个答案:

没有答案