Skip to content

Instantly share code, notes, and snippets.

@mojodna
Created January 18, 2012 17:09
Show Gist options
  • Save mojodna/1634116 to your computer and use it in GitHub Desktop.
Save mojodna/1634116 to your computer and use it in GitHub Desktop.
Implementation of pending for nodeunit
var pending = function(test, fn) {
var assert = require('assert');
assert.done = function() {
test.done();
};
var failed = false;
try {
fn(assert);
} catch (e) {
failed = true;
} finally {
if (failed) {
// TODO how do we access the test name?
// probably need to hook into the nodeunit reporter
console.log('Pending: <test name>');
test.done();
} else {
console.error('Test succeeded where it was expected to fail.');
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment