【发布时间】:2017-11-13 19:13:47
【问题描述】:
所以我有一个非常基本的测试,我想在使用 Jasmine 的测试中检查 Promise 响应的类型。我正在运行一个节点项目并设置了所有这些细节
describe('fail assertion', function() {
it('should be a failure', function(done) {
myvideopromise.then(function(resp) {
expect(true).toBe(false);
done();
}).catch(done);
});
});
describe('list videos', function() {
it('should return a list of videos', function(done) {
myvideopromise.then(function(videos) {
expect(Array.isArray(videos)).toBe(true);
done();
}).catch(done);
});
});
但是当我运行它时,我只会在下面看到这个。
Started
F.
Failures:
1) video suite fail assertion should be a failure
Message:
Expected true to be false.
“F”是红色的,“.”是红色的。是绿色的。所以看起来它正在正确运行测试断言,但是对于成功它似乎没有显示成功消息。有没有我需要通过的标志之类的?我正在使用它来调用它
jasmine JASMINE_CONFIG_PATH=test/jasmine_config.json
而我的 jasmine_config.json 文件看起来就像
{
"spec_dir": "test/other/",
"spec_files": [
"video_tests.js"
]
}
【问题讨论】:
-
我尝试将这些字段设置为 true,但它们似乎没有做任何事情