Created
December 10, 2012 17:48
-
-
Save jaredhirsch/4252102 to your computer and use it in GitHub Desktop.
The sad suckage that is vows XML reporter
This file contains hidden or 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
#!/usr/bin/env node | |
const runner = require('./lib/runner.js'), | |
testSetup = require('./lib/test-setup.js'), | |
assert = require('./lib/asserts.js'); | |
// assert = require('assert'); | |
var browser; | |
const utils = require('./lib/utils.js'); | |
runner.run(module, { | |
'error text should report as XML correctly': function(done) { | |
debugger; | |
process.exit(1) | |
utils.waitFor(10, 100, function(cb) { | |
cb.call(false); // always fails the check, so that timeout occurs | |
}, done); | |
}, | |
'another function': function(done) { | |
debugger; // what's the value of done? | |
done() | |
}, | |
'Errors should also report as XML correctly': function(done) { | |
done(new Error('aw man')); | |
}, | |
'uncaught Errors should also report as XML correctly': function(done) { | |
throw new Error('uncaught'); | |
done() | |
}, | |
'uncaught AssertionErrors cause destruction': function(done) { | |
throw new AssertionError('blah!'); | |
done() | |
}, | |
'asserts that fail should report as XML correctly': function(done) { | |
done(assert(false)) | |
}, | |
'asserts that access properties of undefined objects should report as XML correctly?': function(done) { | |
done(assert('foo' == undef.undef)) | |
}, | |
'setup a browser for wd error handling testing': function(done) { | |
testSetup.setup({ b:1 }, function(err, fix) { | |
browser = fix.b[0]; | |
done(err) | |
}); | |
}, | |
'passing err responses from wd to done should report as XML correctly': function(done) { | |
browser.chain() | |
.newSession(testSetup.sessionOpts) | |
.get('http://www.persona.org') | |
.wfind('.thisDefinitelyDoesNotExist', function(err, el) { | |
done(err) | |
}); | |
}, | |
'passing asserts into the callback reports correctly': function(done) { | |
browser.wfind('.thisDefinitelyDoesNotExistAlso', function(err, el) { | |
done(err || assert(el)) | |
}); | |
}, | |
'try/catching AssertionErrors reports as XML correctly': function(done) { | |
browser.wfind('.thisDefinitelyDoesNotExistAlso', function(err, el) { | |
try { assert(el) } catch (e) { done(e) } | |
done() | |
}); | |
}, | |
'uncaught AssertionErrors WILL break the XML reporter, oh continuation-passing style.': function(done) { | |
browser.chain() | |
.newSession(testSetup.sessionOpts) | |
.get('http://www.persona.org') | |
.wtext('.thisonetoo', function(err, txt) { | |
done(err || assert.equal(txt, 'blah')) | |
}) | |
.wfind('div', function(err, el) { | |
done(err || assert.ok(el)) | |
}) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment