Jasmine 在向其添加第 14 个规范后报告未找到规范消息(它是否是工作规范的副本无关紧要)。如果我使用一个自制的报告器,它表明它通过了所有规格没有问题,但它报告最终结果没有找到规格。
添加了控制台日志以显示我的意思
Started
[#quickSort]
Results Top Level Tests
------- ---------------
.Passed should sort small array
.Passed should hallo small array
.Passed should sort array with identical values
.Passed should do nothing with empty array
.Passed shouldn't sort a string
.Passed should do nothing with array with single field
Group "#quickSort" was finished
[#signature]
Results Top Level Tests
------- ---------------
[#signature Write signatureformat Remove]
Results Top Level Tests
------- ---------------
.Passed Compact 1/2; Remove additional x/y members
.Passed Compact 2/2; Also remove additional x/y members in sequential paths
Group "Write signatureformat Remove" was finished
[#signature Write signatureformat Reposition]
Results Top Level Tests
------- ---------------
.Passed Reposition 1/2; Reposition top-left to 0,0 for more compact output
.Passed Reposition 2/2; Reposition top-left to 0,0 for more compact output
Group "Write signatureformat Reposition" was finished
[#signature Write signatureformat Downscale]
Results Top Level Tests
------- ---------------
.Passed Downscale 1/2; Downscale when needed with minimal resolution loss, so it will never get to large (-2000..2000)
.Passed Downscale 2/2; Downscale when needed with minimal resolution loss, so it will never get to large (-2000..2000)
Group "Write signatureformat Downscale" was finished
.Passed Write signatureformat - Complex export
.Passed Write signatureformat - Rotate 180 degrees
Group "#signature" was finished
Started
No specs found
Finished in 0.002 seconds
这也是 spec_runner 的来源
//var exit = require('exit');
var Jasmine = require('jasmine'),
reporters = require('jasmine-reporters');
var junitReporter = new reporters.NUnitXmlReporter({
savePath: __dirname,
consolidateAll: true
});
var myReporter = {
jasmineStarted: function (suiteInfo) {
},
suiteStarted: function (result) {
console.log('[' + result.fullName + ']');
console.log('');
console.log('Results Top Level Tests');
console.log('------- ---------------');
},
specStarted: function (result) {
},
specDone: function (result) {
var line = result.status.substr(0, 1).toUpperCase() + result.status.substr(1);
if (line === "Failed") line = "+" + line;
while (line.length < 22) line += " ";
console.log(line + result.description);
},
suiteDone: function (result) {
console.log('');
console.log('Group "' + result.description + '" was ' + result.status);
for (var i = 0; i < result.failedExpectations.length; i++) {
console.log('AfterAll ' + result.failedExpectations[i].message);
console.log(result.failedExpectations[i].stack);
}
console.log('');
console.log('');
// werkt gewoon niet???? [rv]
//if (result.status !== "passed") exit(1)
},
jasmineDone: function () {
}
};
var jasmine = new Jasmine();
jasmine.loadConfigFile("spec/support/jasmine.json");
jasmine.addReporter(myReporter);
jasmine.execute();
原文由 Strike08 发布,翻译遵循 CC BY-SA 4.0 许可协议
解决它。问题出在 package.json 中。我用过
"scripts":{"test": "jasmine spec/spec_runner.js"}
这导致茉莉花运行了 2 次。通过使用修复它
"scripts":{"test": "node spec/spec_runner.js"}