Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
});
@mvasilkov

This comment has been minimized.

Copy link

commented Sep 8, 2012

Thanks, this helped a lot.

@yamsellem

This comment has been minimized.

Copy link

commented Dec 13, 2012

You save my day ^^

@pajtai

This comment has been minimized.

Copy link

commented Dec 31, 2012

Exactly what I was looking for! Didn't know about QUnit.config.autostart

@BenDavidJamin

This comment has been minimized.

Copy link

commented Feb 12, 2013

Was looking for something along these lines. Thanks!

@aubricus

This comment has been minimized.

Copy link

commented Feb 16, 2013

Indeed, thanks!

@roycehaynes

This comment has been minimized.

Copy link

commented Mar 27, 2013

Hm, not working for me. My config.js file...

config.js

https://gist.github.com/roycehaynes/26376f8aa213e6de654a

Thoughts?

@ciastek

This comment has been minimized.

Copy link

commented Jun 10, 2013

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

@attebury

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.