Skip to content

Instantly share code, notes, and snippets.

@peterwmwong
Created January 11, 2011 05:40
Show Gist options
  • Save peterwmwong/774074 to your computer and use it in GitHub Desktop.
Save peterwmwong/774074 to your computer and use it in GitHub Desktop.
Vows teardown test case with console.log
vows.describe("Vows with teardowns").addBatch({
"A context": {
topic: function () {
return { flag: true };
},
"And a vow": function (topic) {
assert.isTrue(topic.flag);
},
"And another vow": function (topic) {
assert.isTrue(topic.flag);
},
"And a final vow": function (topic) {
assert.isTrue(topic.flag);
},
teardown: function (topic) {
/*******************************/
console.log('TEAR DOWN CALLED');
/*******************************/
topic.flag = false;
}
}
}).export(module);
@Marak
Copy link

Marak commented Jan 11, 2011

Seems to be working over here...

♢ Vows with teardowns

A context
✓ And a vow
✓ And another vow
✓ And a final vow

✓ OK » 3 honored (0.002s)
TEAR DOWN CALLED
Marak-Squiress-MacBook-Pro:vows maraksquires$

Are you saying that you don't see the console output if you run this suite? Also, I checked the teardown code a bit in suite.js and it appears the teardown only executes if the suite was successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment