Created
January 18, 2012 17:09
-
-
Save mojodna/1634116 to your computer and use it in GitHub Desktop.
Implementation of pending for nodeunit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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