我想知道我在这里是否遗漏了一些微不足道的东西,但如果我在karma配置中将singlerun设置为true,我就看不到任何测试报告。它只显示浏览器已启动,就是这样。我可以点击 DEBUG 并以这种方式检查浏览器控制台日志,但我觉得也应该在终端中看到结果。
感谢您的帮助!
我的karma.config.js:
basePath: '../', // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['PhantomJS'], frameworks: ['mocha', 'chai'], files: [ { pattern: 'test/vendor/indexeddbshim.min.js', watched: false }, { pattern: 'tests.webpack.js', watched: false }, ], preprocessors: { 'tests.webpack.js': ['webpack'], }, webpack: { resolve: { root: [ path.resolve('./test/vendor'), ], alias: { backbone: 'backbone', underscore: 'underscore', }, }, module: { loaders: [ { // test: /^\.js$/, exclude: /(node_modules|bower_components|vendor)/, loader: 'babel-loader', }, ], }, }, webpackServer: { noInfo: true, }, // enable / disable watching file and executing tests whenever any file changes autoWatch: false, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'], // web server port port: 9876, // enable / disable colors in the output (reporters and logs) colors: true, // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false, plugins: [ require('karma-webpack'), require('karma-mocha'), require('karma-chai'), require('karma-phantomjs-launcher'), require('karma-chrome-launcher'), ], logLevel: config.LOG_INFO, });
答案 0 :(得分:6)
从上面的评论:
设置singleRun: false
假设您明确地手动启动了karma-client。
这意味着你开始业力(技术上是业力服务器),然后转到另一个终端并输入karma run
。
在你的业力配置中设置singleRun: true
将为你调用业力。