Skip to content
This repository was archived by the owner on May 11, 2021. It is now read-only.

Commit df5df4b

Browse files
author
Justin Jaffray
committed
Fix phantomjs test runner with requirejs
Summary: The problem is QUnit is loaded before everything else, so it fires the QUnit.done event before any of the tests have actually ran. This kind of hacky fix just has the test runner ignore a QUnit.done event that didn't actually run any tests. It's kind of ugly but I am not sure if there's a simpler solution. I also tried moving QUnit into a require in the last callback, but that caused the test runner to complain that QUnit wasn't present. Test Plan: * `phantomjs test/runner.js test/index.html` Reviewers: jack, alpert Reviewed By: alpert CC: alpert Differential Revision: http://phabricator.khanacademy.org/D7217
1 parent 22fd3d4 commit df5df4b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/runner.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@
176176
});
177177

178178
QUnit.done(function ( result ) {
179+
// Because the tests are loaded asynchronously, QUnit
180+
// originally thinks that it's done because none of them have
181+
// loaded yet.
182+
if ( result.total === 0 ) {
183+
return
184+
}
179185
console.log( "---------------" );
180186
console.log( "Took " + result.runtime + "ms to run " + result.total + " tests. " + ANSI.colorizeText( result.passed + " passed", "green" ) + ", " + ANSI.colorizeText( result.failed + " failed", "red" ) + "." );
181187
console.log( "---------------" );
@@ -189,4 +195,4 @@
189195
});
190196
}, false );
191197
}
192-
})();
198+
})();

0 commit comments

Comments
 (0)