这是test-main.js
,基本上是运行cfx init
..
var main = require("./main");
exports["test main"] = function(assert) {
assert.pass("Unit test running!");
};
exports["test main async"] = function(assert, done) {
assert.pass("async Unit test running!");
done();
};
require("sdk/test").run(exports);
这是输出,为什么会说2 of 3 tests passed
?
当只导出2种测试方法时。
[rob@laptop addon]$ ~/apps/addon-sdk-1.17/bin/cfx test
Using binary at '/usr/bin/firefox'.
Using profile at '/tmp/tmpdrQaVV.mozrunner'.
Running tests on Firefox 31.1.0/Gecko 31.1.0 ({ec8030f7-c20a-464f-9b0e-13a3a9e97384}) under linux/x86_64.
console.warn: addon: Plural form unknown for locale "null"
System JS : ERROR chrome://browser/content/browser.js:14338 - TypeError: value is not a non-null object
System JS : ERROR chrome://browser/content/content-sessionStore.js:230 - TypeError: docShell.QueryInterface(...).sessionHistory is null
console.error: addon:
warnings and/or errors were logged.
2 of 3 tests passed.
Total time: 3.634853 seconds
Program terminated unsuccessfully.