为帮助您回答这个问题,我将复制并粘贴我的业力配置文件,请让我知道如何进行修改,以便tfs理解。
我尝试添加无头浏览器phantom.js,但仍在tfs内,它尝试打开chrome并失败!!!
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'server/**/*.spec.js'
],
exclude: [
],
preprocessors: {
'server/**/*.js': ['coverage']
},
coverageReporter: {
type : 'html',
dir : 'coverage/'
},
reporters: ['progress', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['Chrome'],
singleRun: true,
concurrency: Infinity
})
}
基于一些建议,我将karma.conf.js更改为使用phantom.js,这产生了更多问题,无法识别打字稿文件,并抱怨整个打字稿文件为语法错误。这是修改后的文件
module.exports = function (config) {
config.set({
frameworks: ['jasmine'],
files: [
'./app/*.spec.ts',
'./app/**/*.spec.ts'
],
plugins: [
require('karma-jasmine'),
require('karma-webpack'),
require('karma-phantomjs-launcher'),
require('karma-tfs-reporter')
],
preprocessors: {
'./app/*.spec.ts': ['webpack'],
'./app/**/*.spec.ts': ['webpack']
},
webpack: {
},
webpackMiddleware: {
stats: 'errors-only'
},
browsers: ['PhantomJS'],
reporters: ['progress', 'tfs'],
// Default settings (optional)
tfsReporter: {
outputDir: 'testresults',
outputFile: 'testresults_${date}.xml'
}
})
}