Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added a config for backward compat #13

Merged
merged 3 commits into from Apr 13, 2012
Jump to file or symbol
Failed to load files and symbols.
+13 −3
Split
@@ -44,7 +44,7 @@ YUITest.CLI = {
//Workaround for https://github.com/joyent/node/issues/1669
var flushed = process.stdout.flush && process.stdout.flush();
- if (!flushed) {
+ if (!flushed && (parseFloat(process.versions.node) < 0.5)) {
process.once("drain", function () {
process.exit(code || 0);
});
@@ -210,10 +210,20 @@
* @static
*/
this._groups = "";
+
}
TestRunner.prototype = YUITest.Util.mix(new YUITest.EventTarget(), {
-
+
+ /**
+ * If true, YUITest will not fire an error for tests with no Asserts.
+ * @prop _ignoreEmpty
+ * @private
+ * @type Boolean
+ * @static
+ */
+ _ignoreEmpty: false,
+
//restore prototype
constructor: YUITest.TestRunner,
@@ -596,7 +606,7 @@
segment.call(testCase, this._context);
//if the test hasn't already failed and doesn't have any asserts...
- if(YUITest.Assert._getCount() == 0){
+ if(YUITest.Assert._getCount() == 0 && !this._ignoreEmpty){
throw new YUITest.AssertionError("Test has no asserts.");
}
//if it should fail, and it got here, then it's a fail because it didn't