gpt4 book ai didi

javascript - Jasmine 与 karma : Cannot find variable runs

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:08:05 26 4
gpt4 key购买 nike

我需要一个插件/lib 来使用 Jasmine 的 runs() 和 waits() 吗?我正在查看异步测试的 Jasmine 维基页面:https://github.com/pivotal/jasmine/wiki/Asynchronous-specs .

他们没有提到需要特殊的库/插件,所以我认为 runs() 和 waits() 应该开箱即用。

我的代码看起来像这样(它包含在描述中):

it('test', function() {
runs(function() {

});
});

我得到:ReferenceError: runs is not defined

我的 karma 配置的相关部分是:

    files: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/*.js',
'test/*.spec.js'
],


frameworks: ['jasmine'],

browsers: ['PhantomJS'],

plugins: [
'karma-spec-reporter',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-phantomjs-launcher'
],

最佳答案

好的,原来 Jasmine 2.0 已经删除了 runs()waits()waitsFor()。新的异步支持使用 done(),可在以下位置找到:http://jasmine.github.io/2.0/introduction.html#section-Asynchronous_Support .我已经在过时的 github wiki 页面上添加了关于此的快速注释。

关于javascript - Jasmine 与 karma : Cannot find variable runs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22493163/

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