【发布时间】:2014-01-31 00:22:48
【问题描述】:
我有一个如下所示的测试套件:
(注意顶部的accountToPost 变量(在第一个describe 块下方)
describe('Register Account', function () {
var accountToPost;
beforeEach(function (done) {
accountToPost = {
name: 'John',
email: 'email@example.com',
password: 'password123'
};
done();
});
describe('POST /account/register', function(){
describe('when password_confirm is different to password', function(){
//accountToPost is undefined!
accountToPost.password_confirm = 'something';
it('returns error', function (done) {
//do stuff & assert
});
});
});
});
我的问题是,当我尝试在嵌套的描述块中修改 accountToPost 时,它是未定义的......
我能做些什么来解决这个问题?
【问题讨论】:
标签: javascript node.js mocha.js