[英]before/afterAll() is not defined in jasmine-node
我试图使用方法beforeAll和茉莉毕竟 ,建立一套与frisby.js测试,因为实际上,弗里斯比没有此方法的支持。 所以,这就是我要做的事情:
var frisby = require('frisby');
describe("setUp and tearDown", function(){
beforeAll(function(){
console.log("test beforeAll");
});
afterAll(function(){
console.log("afterAll");
});
//FRISBY TESTS
}); //end of describe function
如果我将before / afterAll之前的方法更改为before / afterEach,则工作正常,但是当我使用before / afterAll时,此错误会出现在控制台上:
消息:ReferenceError:未定义beforeAll Stacktrace:ReferenceError:未定义beforeAll
我在我的项目上安装了jasmine版本2.3.2,所以,我不知道我需要做什么来集成这个方法。
使用jasmine库而不是jasmine-node库。 第二个不支持beforeAll和afterAll方法。
1- npm install -g jasmine
2-茉莉花初生
3-在spec文件夹中写测试:
describe("A spec using beforeAll and afterAll", function() {
var foo;
beforeAll(function() {
foo = 1;
});
afterAll(function() {
foo = 0;
});
it("sets the initial value of foo before specs run", function() {
expect(foo).toEqual(1);
foo += 1;
});
it("does not reset foo between specs", function() {
expect(foo).toEqual(2);
});
});
4-运行测试 - > jasmine
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.