gpt4 book ai didi

angularjs - 在没有当前规范时使用“期望”,这可能是因为Jasmine 2.3.1中的异步测试超时

转载 作者:行者123 更新时间:2023-12-03 13:37:07 24 4
gpt4 key购买 nike

我正在通过gulp运行业力测试用例,如下所示:

gulp.task('unit-test-karma', function () {
return gulp.src(filePaths.libraryPaths.concat(filePaths.codePathsVerbose.concat(filePaths.testPaths).concat(filePaths.htmlPaths).concat(filePaths.jadePaths)))
//.pipe(plumber({ errorHandler: notify.onError(function(error) { console.log(error.message); return "Karma Error"; }) }))
.pipe(karma({
configFile: './karma.conf.js',
action: 'run', // watch
singleRun: true,
reporters: [ 'dots' ]
}));
});

当我以 run作为操作运行时,IE 11抛出以下错误。
IE 11.0.0 (Windows 10 0.0.0) ERROR
'expect' was used when there was no current spec, this could be because an asynchronous test timed out
at C:/BbCAT-WebDI/BbCAT-Web/BbCAT-Angular/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:938

但是,如果以与 watch相同的方式运行,则所有测试用例都将在chrome,IE和firefox中成功执行。

在阅读了一些帖子之后,$ http服务调用似乎出现了问题,但无法从根本上找到问题所在!

最佳答案

这是一个非常现实的问题,我目前也正在经历。我认为这里有一个核心错误。我有很好的封装测试。它们很小(每条最多3行)

我有一个带有两个嵌套描述的主要描述部分
首先描述有8个it()函数
第二个具有3it()函数。


describe("main", ()=>{
describe("1st", ()=>{
//here are 8 it() definitions
})
describe("2nd", ()=>{
//here are 3 it() definitions
})
})

现在,当我从两个描述中删除单个it()定义时,问题就消失了。另外,如果我添加第三个describe(),问题将消失。

这是 Jasmine 中的一个问题- Jasmine 无法正确报告错误,或者出现严重错误。或者,可能是通过同时运行多个测试来尝试变得聪明的业力。

也许与所测试的基础单元有关–我的功能是递归的(尽管我的测试用例并未深入探讨)。

业力 Jasmine @ 0.3.8

Jasmine 芯@ 2.4.1

业力@ 0.13.22

phantomjs-prebuilt@2.1.7

业力-phantomjs-launcher@1.0.0

关于angularjs - 在没有当前规范时使用“期望”,这可能是因为Jasmine 2.3.1中的异步测试超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34469116/

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