Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8163529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:04:56+00:00 2026-06-06T19:04:56+00:00

Wow, what a mess. This is the scenario. Backbone driven JS app. RequireJS for

  • 0

Wow, what a mess. This is the scenario.

  • Backbone driven JS app.
  • RequireJS for AMD functionality, initialized like this:

    <script data-main="js/main" src="js/require.js" type="text/javascript"></script>
    

    then inside main.js the following config code:

    require.config(
    {
        paths:
        {
            ... : ...
        }
    });
    

    Each Backbone View/Model/Router is a “define(…)” module, and “require(“theOneRouter”, …)” is called once in main.js.

  • r.js used as optimizer with Uglify/Closure. One ‘compiled’ main.js is created in a ./release subfolder which I pick dynamically within my .net framework.

  • Took quite a while to get the Backbone + Require.JS to work, but works great now!

  • Then slapping Jasmine on top of that also took a little custom work, but it worked just fine. I had to load require.js from my SpecRunner.html, define each test module as an AMD using require’s define(…) call, and I instantiate & run Jasmine once from a call to require’s require(…) call once in the SpecRunner.html:

    require(
    [
    //"test/specs/testSpec1",
    "test/specs/views"
    ],
    function ()
    {
        jasmine.getEnv().updateInterval = 1000;
        var reporter = new jasmine.TrivialReporter();
        jasmine.getEnv().addReporter(reporter);
        ....
        ....
    });
    

    this too works great. Tests load & run, no issues. Require takes care of everything.

Now, I would like a framework like JSTestDriver to act as my runner. I’ve chosen JSTD for it’s simplicity, ability to test on remote browsers, code coverage support, but am still open for other suggestions.

JSTestDriver per se works fine, the only problem I have is running the combination JSTD + Jasmine + ReuireJS together. The biggest issue being, if I tell JSTD in the config file about a Jasmine/Require test module in order to load it, I get the following error:

http://requirejs.org/docs/errors.html#mismatch

If I use r.js to optmize all my code into one main.js, the combination works, including Coverage, but coverage is collected on one gigantic file and hard to analyze. Not to mention it takes very long to instrument a 50k-lines-of-code js file and to run it via JSTD.

I tried creating a fixture-like js file that loads all my Jasmine test modules & code modules, but I keep returning to the above “mismatch” error, AND, if I don’t tell JSTD about each module individually (by loading an html/js fixture that does the real loading) they won’t get instrumented for code coverage.

Has anyone gotten this specific combination to work?
Maybe I’m asking for too much…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:04:58+00:00Added an answer on June 6, 2026 at 7:04 pm

    The solution is exactly as devadvocate mentioned. Because JsTestDriver and Require.js are competing to be the ones to manage the loading of files/dependencies, JsTestDriver throws a fit when you try to do it 100% the Require.js way (with anonymous modules and defines). Instead you have to name your modules and use require([…], function(…) {… instead of define([…]. I wrote a post that shows how to integrate QUnit, Requirejs, and code coverage with JSTD: js-test-driver+qunit+coverage+requirejs. I use QUnit in my example, but you can easily substitute QUnit for Jasmine. In trying to figure this out I considered just using PhantomJS, but for our user base it is essential that we have cross-browser testing, IE7,IE8,IE9, etc., so a single WebKit wouldn’t cut it. JsTestDriver is very useful, but I’m afraid poor documentation turns developers away. Soon I’ll get the code for my example up on GitHub. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable with hyper links (www.wow.com) like this. I have to pass
Wow now i know I dont. Lol. I've got my structure like this: struct
I have some xml like this: <animal name=Bow Wow type=dog> <birthDate>May 17,2001</birthDate> <descirption>Bla bla
I have this website i need to parse for an android app. http://www.wow-coupons.com/rss_online_coupons.xml I
This is a WoW (World of Warcraft) lua script question. Not many of these
I saw app inventor and have tried it and thought wow this could really
Wow I've been struggling with this for whole day, following the official ruby on
Oh wow is this one annoying me. Using c#, winforms, visual studio 2010 ulti.
// Edit: oh wow. It's odd that I've been working on this for a
This confused me a lot var show = function(){ console.log('wow'); }; var show2 =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.