Vows.js: Accessing parameters returned from outer topics inside inner topics
I was wondering if there is any way to obtain the return value of an outer topic, from within a test of an inner topic. If that was confusing, here's an example:
"build.css" : {
topic : function(file) {
fs.readFile(fixtures + "/public/build.css", "utf8", this.callback);
},
'exists' : function(err, build) {
assert.开发者_如何学GoisNull(err); // This is fine..
},
{
'should contain' : {
topic : function() {
return "wahoo";
},
'some cool css' : function(wahooString, err, build) {
// Where did build go? Can I still access it from this scope?
}
...
}
...
Pseudo Code:
'should contain' : {
topic : function(err, build) {
this.callback(err, build, "wahoo");
return undefined;
},
'some cool css' : function(err, build, wahooString) {
// Where did build go? Can I still access it from this scope?
}
...
Basically you get the previous topics data in any sub topic. You then need to manually pass it to the vows. Yes it is a pain.
精彩评论