Search
 

go back home...

QUnit, Grunt, and Require. Problems?

I ran into a problem yesterday when I started writing tests for a personal project. I completed writing my tests, and then ran them in the browser. YES, they worked!! Hell yeah.

So then I go and add the tests to my Gruntfile.js so I can run them before I build my project everytime. At this point I'm thinking to myself, "This is going to be easy. I got all the heavy lifting done".

I finish integrating it into my build process and run grunt qunit. It's doing something... It's doing something... then I get something like the following:

Running "qunit:all" (qunit) task
Testing test/index.htmlOK
Warning: 0/0 assertions ran (15ms) Use --force to continue.

I go through the normal troubleshooting process, but I cannot seem to figure it out. Everything loads correctly in the browser, so why isn't it loading in my build process!!

After a few hours of toiling, and staying up way past my bedtime, I finially thought that it could be something with RequireJS. Lo and behold, I found this. It DOES NOT work with the version of Require I was using.

Long story short, downgraded to Require v2.0.2 for my tests (can use up to v2.0.6 and it will still work), and now grunt, qunit, and require all play nice.

I swear I almost pulled out my hair on this one.

 

I am a life-long learner, adventure seeker, and front-end developer for @ExactTarget