我的Karma不会开始

时间:2016-06-16 16:30:02

标签: angularjs karma-jasmine

或者,更确切地说,它开始但很多时候它并没有产生结果。它只是返回一个命令提示符。这只会在某些时候发生 - 我可以运行一次并且它可以工作,然后在命令窗口中使用向上箭头它会失败。当测试只报告一些时间时,它浪费了很多时间。有谁见过这个?

修改karma start

开头

Karma.config:

// Karma configuration
// Generated on Thu Sep 18 2014 07:48:58 GMT-0700 (Pacific Daylight Time)

module.exports = function (config) {
    var rootDir = 'TestSplitContent';
    config.set({

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

        browserNoActivityTimeout: 30000,

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

        // list of files / patterns to load in the browser
        //TODO: make more generic, while still keeping correct load order so Karma can pick up new files
        files: [
            rootDir + '/scripts/jquery-2.0.3.js',
            rootDir + '/scripts/angular.js',
            rootDir + '/scripts/angular-mocks.js',
            rootDir + '/scripts/angular-animate.js',
            rootDir + '/scripts/angular-route.js',
            rootDir + '/scripts/angular-sanitize.js',
            rootDir + '/scripts/angular-resource.js',
            rootDir + '/scripts/angular-touch.js',
            rootDir + '/scripts/bootstrap.js',
            rootDir + '/scripts/toastr.js',
            rootDir + '/scripts/moment.js',
            rootDir + '/scripts/angular-ui/ui-bootstrap.js',
            rootDir + '/scripts/angular-ui/ui-bootstrap-tpls.js',
            rootDir + '/scripts/spin.js',
            rootDir + '/scripts/bootstrap-collapse.js',
            rootDir + '/app/app.js',
            rootDir + '/app/config.js',
            rootDir + '/app/config.exceptionHandler.js',
            rootDir + '/app/common/common.js',
            rootDir + '/app/common/commonFilters.js',
            rootDir + '/app/common/xmlParseWrapper.js',
            rootDir + '/app/common/mediaAssetService.js',
            rootDir + '/app/common/logger.js',
            rootDir + '/app/common/spinner.js',
            rootDir + '/app/common/angular-local-storage.js',
            rootDir + '/app/common/imagePreloader.js',
            rootDir + '/app/common/bootstrap/bootstrap.dialog.js',
            rootDir + '/scripts/Types/BrowserInfo.js',
            rootDir + '/scripts/Types/ConnectionSpeed.js',
            rootDir + '/scripts/Utilities/DeviceCaps.js',
            rootDir + '/scripts/Utilities/GeneralUtilities.js',
            rootDir + '/scripts/Utilities/string.js',
            rootDir + '/scripts/WebServiceUtils/AjaxAsyncAPI.js',
            rootDir + '/scripts/WebServiceUtils/AjaxSyncAPI.js',
            rootDir + '/scripts/WebServiceUtils/BoolDataMessage.js',
            rootDir + '/scripts/WebServiceUtils/BoolMessage.js',
            rootDir + '/scripts/WebServiceUtils/Utils.js',
            rootDir + '/scripts/assessment/custom.module.js',
            rootDir + '/app/layout/shell.js',
            rootDir + '/app/controllers/NotFound.js',
            rootDir + '/app/services/*.js',
            /*modules*/
            rootDir + '/app/signon/bypass/bypass.module.js',
            rootDir + '/app/culturefit/cultureFit.module.js',
            rootDir + '/app/dataverification/dataVerification.module.js',
            rootDir + '/app/feedback/feedback.module.js',
            rootDir + '/app/signon/nonIntegrated/nonIntegrated.module.js',
            rootDir + '/app/signon/orderFiller/orderFiller.module.js',
            rootDir + '/app/signon/signon.module.js',
            rootDir + '/app/signon/selfSignOn/selfSignOn.module.js',
            rootDir + '/app/sitjudge/sitJudge.module.js',
            rootDir + '/app/startup/startup.module.js',
            rootDir + '/app/thankYou/thankYou.module.js',
            rootDir + '/app/workhistory/wh.module.js',
            rootDir + '/app/workstyle/ws.module.js',
            rootDir + '/app/mth/mth.module.js',

            rootDir + '/app/assessmentState/*.*',
            rootDir + '/app/assessmentState/*/*.*',
            rootDir + '/app/composite/*.*',
            rootDir + '/app/dataverification/*.*',
            rootDir + '/app/dataverification/instructions and example/*.*',
            rootDir + '/app/dragAndDrop/*.*',
            rootDir + '/app/error/*.*',
            rootDir + '/app/factory/*.js',
            rootDir + '/app/formFactor/*.*',
            rootDir + '/app/forms/*.*',
            rootDir + '/app/forms/**/*.*',
            rootDir + '/app/directives/*.js',
            rootDir + '/app/discovery/*.js',
            rootDir + '/app/views/directives/*.html',
            rootDir + '/app/feedback/*.*',
            rootDir + '/app/mth/*.*',
            rootDir + '/app/multiTasking/*.*',
            rootDir + '/app/multiTasking/*/*.*',
            rootDir + '/app/orderFiller/*.*',
            rootDir + '/app/rb/*.*',
            rootDir + '/app/signon/*.*',
            rootDir + '/app/signon/**/*.*',
            rootDir + '/app/sitjudge/*.*',
            rootDir + '/app/sitjudge/**/*.*',
            rootDir + '/app/startup/*.*',
            rootDir + '/app/strategyRichness/*.*',
            rootDir + '/app/strategyRichness/**/*.*',
            rootDir + '/app/prio/**/*.*',
            rootDir + '/app/problemSolving/**/*.*',
            rootDir + '/app/textBox/*.*',
            rootDir + '/app/thankYou/*.*',
            rootDir + '/app/workstyle/*.*',
            rootDir + '/app/workhistory/*.*',
            rootDir + '/app/culturefit/**/*.*',
            rootDir + '/app/exercise/*.*',
            rootDir + '/app/rjp/*.js',
            rootDir + '/app/rjp/**/*.js',
            rootDir + '/app/app.core.js',

            //pallet stacking
            'PalletStackingLevelEditor/app/*/*.js',


            /*  To replace a real implementation with a mock implementation,
                put a mock in the mocks folder and it will overwrite the real mapping
            */
            'VJTNext.Tests/Jasmine_Tests/**/*.js',
            'VJTNext.Tests/Jasmine_Tests/*.js',

            // fixtures
            { pattern: 'VJTNext.Tests/Jasmine_Tests/mocks/*.json', watched: true, served: true, included: false }
        ],


        // list of files to exclude
        exclude: [
            rootDir + '/app/run.js'
        ],

        plugins: ['karma-ng-html2js-preprocessor', 'karma-jasmine', 'karma-xml-reporter', 'karma-chrome-launcher'],


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

        ngHtml2JsPreprocessor: {
            stripPrefix: rootDir + '/'
        },


        // test results reporter to use
        // possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        reporters: ['progress', '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_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'/*', Firefox', 'IE'*/],


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

0 个答案:

没有答案