Karma无法匹配任何js文件

时间:2015-12-16 12:08:07

标签: karma-runner

我发了

karma start karma.conf.js  --log-level debug --single-run

得到

  

16 12 2015 14:53:16.764:WARN [plugin]:加载“C:\ Users \ denis.ev \ AppData \ Roaming \ npm \ node_modules / karma-phantomjs-launcher”插件时出错:     找不到模块'phantomjs'

     

16 12 2015 14:53:17.245:警告[记者]:无法加载“junit”,它未注册!     也许你错过了一些插件?

     

16 12 2015 14:53:17.510:WARN [watcher]:模式“C:/Users/denis.ev/Documents/Bleu [hottask] /Bleu.Web/src/assets/libs/jquery-2.1.4 .js“与任何文件都不匹配。

     

16 12 2015 14:53:17.578:WARN [观察者]:模式“C:/Users/denis.ev/Documents/Bleu [hottask] /Bleu.Web/src/assets/libs/moment.js”不匹配任何文件。

     

16 12 2015 14:53:17.603:WARN [观察者]:模式“C:/Users/denis.ev/Documents/Bleu [hottask] /Blu.Web/src/assets/libs/bootstrap.js”不匹配任何文件。

     

16 12 2015 14:53:17.711:WARN [观察者]:模式“C:/Users/denis.ev/Documents/Bleu [hottask] /Bleu.Web/src/assets/libs/angular.js”不匹配任何文件。

     

16 12 2015 14:53:19.426:WARN [watcher]:Pattern“C:/Users/denis.ev/Documents/Bleu [hottask] /Blu.Web/src/assets/libs/angular/angularjs-nvd3 -directives.js“与任何文件都不匹配。

     

16 12 2015 14:53:19.690:INFO [业力]:Karma v0.13.15服务器始于http://localhost:9876/

     

16 12 2015 14:53:19.920:WARN [启动器]:无法加载“PhantomJS”,它未注册!

karma.conf.js

// Karma configuration
// Generated on Tue Jul 22 2014 13:41:07 GMT+0400 (Russian Standard Time)

module.exports = function (config) {
    config.set({

        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '../',


        // frameworks to use
        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
        frameworks: ['jasmine'],


        // list of files / patterns to load in the browser
        /*
         * "~/src/assets/libs/jquery-{version}.js",
                "~/src/assets/libs/moment.js",
                "~/src/assets/libs/bootstrap.js",
                "~/src/assets/libs/angular.js",
                "~/src/assets/libs/angular/angular-ui-router.js",
                "~/src/assets/libs/angular/ui-bootstrap-tpls.js",
                "~/src/assets/libs/angular/ui-grid.js",
                "~/src/assets/libs/angular/angular-moment.js",
                "~/src/assets/libs/angular/datetime-picker.js",
                "~/src/assets/libs/angular/angular-local-storage.js",
                "~/src/assets/libs/angular/ng-tags-input.modified.js",
                "~/src/assets/libs/angular/ng-file-upload.js"
         */
        files: [
            { pattern: 'Bleu.Web/src/assets/libs/jquery-2.1.4.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/moment.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/bootstrap.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/angular-ui-router.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/ui-bootstrap-tpls.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/ui-grid.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/angular-moment.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/datetime-picker.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/angular-local-storage.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/ng-tags-input.modified.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/ng-file-upload.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/ng-sortable.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/angular-ui-tree.js', included: true },
            { pattern: 'Bleu.Web/src/app/*/*.js', included: true },
            { pattern: 'Bleu.Web/src/core/*/*.js', included: true },
            { pattern: 'Bleu.Web/src/**/services/*.js', included: true },
            { pattern: 'Bleu.Web/src/**/models/*.js', included: true },
            { pattern: 'Bleu.Web/src/**/mappers/*.js', included: true },
            { pattern: 'Bleu.Web/src/**/constants/*.js', included: true },
            { pattern: 'Bleu.Web/src/**/enums/*.js', included: true },
            { pattern: 'Bleu.Web/src/**/helpers/*.js', included: true },
            { pattern: 'Bleu.Web/src/core/main/transports/FakeTransport.js', included: true },
            { pattern: 'Bleu.Web.Tests.Client/mocks/*/*.js', included: true },
            { pattern: 'Bleu.Web.Tests.Client/mocks/**/*.js', included: true },
            { pattern: 'Bleu.Web.Tests.Client/testData/**/*.js', included: true },
            { pattern: 'Bleu.Web.Tests.Client/Specs/**/*.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/d3.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/nv.d3.js', included: true },
            { pattern: 'Bleu.Web/src/assets/libs/angular/angularjs-nvd3-directives.js', included: true }
        ],

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


        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        preprocessors: {
        },


        // test results reporter to use
        // possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        //reporters: ['progress'],
        //reporters: ['html'],
        reporters: ['dots', 'junit'],
        junitReporter: {
            outputFile: 'test-results.xml'
        },


        // web server port
        port: 9876,


        // enable / disable colors in the output (reporters and logs)
        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_DEBUG,
        logLevel: config.LOG_ERROR,

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


        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        //browsers: ['Chrome', 'PhantomJS', 'Firefox'],
        browsers: ['PhantomJS'],

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

我的测试需要什么? THX

1 个答案:

答案 0 :(得分:4)

  

警告[记者]:无法加载" junit",它未注册!也许你错过了一些插件?

您没有 juint-reporter插件。通过npm install karma-junit-reporter --save-dev

安装
  

WARN [plugin]:加载时出错" C:\ Users \ denis.ev \ AppData \ Roaming \ npm \ node_modules / karma-phantomjs-launcher"插件:找不到模块' phantomjs'

你没有 phantomjs 。通过npm install -g phantomjs

安装
  

WARN [watcher]:Pattern" C:/Users/denis.ev/Documents/Bleu [hottask] /Blu.Web/src/assets/libs/jquery-2.1.4.js"与任何文件都不匹配。

错误配置文件 basePath 模式。尝试将 basePath 设置为.