gpt4 book ai didi

google-chrome - Chrome 在 karma 中运行两次测试

转载 作者:行者123 更新时间:2023-12-04 01:00:22 26 4
gpt4 key购买 nike

在我的 karma 测试中使用 Chrome 时,我经常(超过所有运行的 50%)看到每个测试被 Chrome 执行两次。您可以在下面找到示例输出和我的配置。

我怎么能阻止这个?原因是什么?

karma start --single-run --browsers Firefox,Chrome

INFO [karma]: Karma v0.12.17 server started at http://localhost:9876/
INFO [launcher]: Starting browser Firefox
INFO [launcher]: Starting browser Chrome

INFO [Chrome 36.0.1985 (Linux)]: Connected on socket RV8G8p63bCLQGaAJW9Hc with id 91444447
Chrome 36.0.1985 (Linux): Executed 0 of 92 SUCCESS (0 secs / 0 secs)
Chrome 36.0.1985 (Linux): Executed 1 of 92 SUCCESS (0 secs / 0.065 secs)
[...]
Chrome 36.0.1985 (Linux): Executed 91 of 92 SUCCESS (0 secs / 0.24 secs)
Chrome 36.0.1985 (Linux): Executed 92 of 92 SUCCESS (0 secs / 0.241 secs)
Chrome 36.0.1985 (Linux): Executed 92 of 92 SUCCESS (0.274 secs / 0.241 secs)
Chrome 36.0.1985 (Linux): Executed 93 of 92 SUCCESS (0.274 secs / 0.258 secs)
[...]
Chrome 36.0.1985 (Linux): Executed 183 of 92 SUCCESS (0.274 secs / 0.412 secs)
Chrome 36.0.1985 (Linux): Executed 184 of 92 SUCCESS (0.274 secs / 0.413 secs)

INFO [Iceweasel 30.0.0 (Linux)]: Connected on socket 4DISHs7012QeIwhEW9Hd with id 93232241

Chrome 36.0.1985 (Linux): Executed 184 of 92 SUCCESS (0.274 secs / 0.413 secs)
Iceweasel 30.0.0 (Linux): Executed 0 of 92 SUCCESS (0 secs / 0 secs)
Chrome 36.0.1985 (Linux): Executed 184 of 92 SUCCESS (0.274 secs / 0.413 secs)
Iceweasel 30.0.0 (Linux): Executed 1 of 92 SUCCESS (0 secs / 0.003 secs)
[...]
Iceweasel 30.0.0 (Linux): Executed 91 of 92 SUCCESS (0 secs / 0.201 secs)
Chrome 36.0.1985 (Linux): Executed 184 of 92 SUCCESS (0.274 secs / 0.413 secs)
Iceweasel 30.0.0 (Linux): Executed 92 of 92 SUCCESS (0 secs / 0.202 secs)
Chrome 36.0.1985 (Linux): Executed 184 of 92 SUCCESS (0.274 secs / 0.413 secs)
Iceweasel 30.0.0 (Linux): Executed 92 of 92 SUCCESS (0.303 secs / 0.202 secs)
TOTAL: 276 SUCCESS

配置:
module.exports = function(config) {
config.set({

basePath : 'www',

frameworks : [ 'jasmine' ],

files : [ 'js/*' ],

exclude : [ 'spec/lib/*.js' ],

reporters : [ 'progress', 'junit', 'html', 'coverage' ],

coverageReporter : {
type : 'html',
dir : 'coverage/'
},

preprocessors : {
'js/*.js' : 'coverage',
},

junitReporter : {
outputFile : 'test-results.xml'
},

colors : true,

logLevel : config.LOG_INFO,

autoWatch : true,

browsers : [ 'Firefox', 'Chrome' ],

captureTimeout : 20000,

reportSlowerThan : 500,

plugins : [ 'karma-jasmine', 'karma-coverage', 'karma-html-reporter', 'karma-chrome-launcher', 'karma-junit-reporter', 'karma-phantomjs-launcher', 'karma-firefox-launcher' ]

});
};

最佳答案

我知道这是一个老问题,但对我来说问题出在 reporters在 karma 配置文件中设置。

我有:reporters: ['progress', 'dots', 'junit']
运行 进度导致测试运行两次(或者更确切地说是显示它运行了两次)。

因此,解决方案是将其中一名记者排除在外。

关于google-chrome - Chrome 在 karma 中运行两次测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24804182/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com