Question

I recently added RequireJS to my project and now have rewritten my JSTestDriver testcases in such a way that they are wrapped by requireJS:

//this does run when running from within WebStorm
require(['backbone', 'models/ParametersModel'],function (backbone, params) {
    TestCase("test aTestCaseInside", {
        setUp: function () {
            assertNotUndefined('backbone is undefined', backbone);
            assertNotUndefined('params is undefined', params);
            this.p = new params();
        },
        //todo: without the backbone dependency everything runs as expected!
        testClass: function () {
            console.log("running a test INSIDE the requireJS context");
            assertEquals("", this.p.getValue(), 'a value from param')
        }
    });
});

When I run this test through the JSTD plugin for JetBrain's Webstorm IDE, it runs fine.

But I would like to be able to run the JSTestDriver from the commandline as well. This does not work however. If I execute this command:

java -jar test\vendor\JsTestDriver\1.3.5\jar\JsTestDriver.jar --config jsTestDriver.jstd --browser "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --port 14999 --tests all --captureConsole --runnerMode PROFILE

I get this output:

feb 13, 2014 10:56:41 AM com.google.jstestdriver.server.handlers.pages.SlavePageRequest createCaptureUrl
SEVERE: Invalid/No runner type specified: null falling back to BROWSER

Total 0 tests (Passed: 0; Fails: 0; Errors: 0) (0,00 ms)
feb 13, 2014 10:56:41 AM com.google.jstestdriver.ActionRunner runActions
INFO:

In the console of the browser I get:

Failed to load resource http://127.0.0.1:14999/query/1392285643189
Failed to load resource http://127.0.0.1:14999/test/vendor/backbone/1.0.0/js/backbone.js

The command on the commandline is correct, since the when I create a TestCase outside of the require function, it does show that the tests have run and passed!

How to configure JSTD with Requiere JS to able to run the tests from the commandline?

Thank you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top