Firefox Addon-SDK单元测试

时间:2013-11-11 18:46:13

标签: unit-testing firefox firefox-addon-sdk

我尝试使用Firefox 25在Firefox Addon SDK 1.14下进行单元测试。

参考https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/unit-testing.html我希望我的测试会在控制台上打印出来。

const {DateFormatter, NumberFormatter} = require("./formatter");

exports['test NumberFormatter'] = function (assert) {
    assert.pass('Unit test running!');
    assert.ok(NumberFormatter.format !== null, 'NumberFormatter available');
};

exports["test NumberFormatter async"] = function (assert, done) {
    assert.pass("async Unit test running!");
    done();
};

require("sdk/test").run(exports);

结果是:

(d:\Nabor\Entwicklung\2013\addon-sdk) d:\Nabor\Entwicklung\2013\skynet\packages\formatter>cfx test
Using binary at 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\temp\nabor\tmptzmpba.mozrunner'.
Running tests on Firefox 25.0/Gecko 25.0 ({ec8030f7-c20a-464f-9b0e-13a3a9e97384}) under winnt/x86-msvc.
...
3 of 3 tests passed.
Total time: 1.588000 seconds
Program terminated successfully.

我想念这个例子中的信息吗?

有什么问题?

1 个答案:

答案 0 :(得分:3)

猜测:缺少--verbose标志

cfx --verbose test