Skip to content

Instantly share code, notes, and snippets.

@drewwells
Created April 14, 2011 20:21
Show Gist options
  • Save drewwells/920405 to your computer and use it in GitHub Desktop.
Save drewwells/920405 to your computer and use it in GitHub Desktop.
RequireJS and QUnit sitting in a tree
//Wait for relevant code bits to load before starting any tests
define(['core.js'], function( core ) {
module("Core Tests");
test("Test core methods", function(){
expect(2);
equals( 1, 1, "A trivial test");
ok( true, "Another trivial test");
});
});
//Main file for loading RequireJS necessary bits
QUnit.config.autostart = false;
require(['core.test.js'], function(){
QUnit.start(); //Tests loaded, run tests
});
@ciastek
Copy link

ciastek commented Jun 10, 2013

Problem with "pushFailure() assertion outside test context". Solution: http://stackoverflow.com/a/15732622/257443

@attebury
Copy link

attebury commented Feb 4, 2014

Thanks @drewwells and @ciastek. Very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment