Quantcast
Channel: Chutzpah - A JavaScript Test Runner
Viewing all articles
Browse latest Browse all 1864

Commented Issue: No tests found when using require.js, jquery, and underscore [90]

$
0
0
I have a situation where Chutzpah is completing with no tests executed, even though there are tests present. There is no error message, it just says zero tests found. I have distilled the situation down to the barest elements necessary for reproduction.

I am using require.js for module management, and have tests in a module which requires both jquery and underscore, which are used for convenience in the real tests. I use a shim for underscore, since it is not an AMD module.

When __both dependencies__ are present in the test module definition, Chutzpah finds no tests. If I comment out __either one of the two dependencies__, it does find the tests in the module. I have reference directives in the test module as well, but their presence or absence seems to have no effect. The file structure of the project is completely flat at present, for simplicity's sake, but putting the 3rd party libraries in a sub-folder and adding path directives has had no effect either.

Attached are the test harness, the test module, and a screenshot showing the file structure.
Comments: I tried using the HTML which includes the tests that I run manually, both with chutzpah.console and from VS, but it didn´t seem to find the tests. The HTML includes the .js which then includes the tests themselves through require.JS, using a require.JS config file for shims. I'm guessing that since the tests are not directly included in the HTML, nor accessible immediately through referenced scripts, Chutzpah might not be able to find them? Or I might be messing up ;). ## Example * tests.html: ``` <script data-main="tests/testsuite" type="text/javascript" src="lib/require.js"></script> ``` * tests/testsuite.ts: ``` /// <reference path="../definitions/require.d.ts" /> require(['require', '../require.config'], function(require) { require([ "tests/unit/test_adapters.js", "tests/screens/test_flix.js", // etc.... ]); }); ``` * tests/unit/test_adapters.ts: ``` import adapters = module('adapters'); QUnit.module('adapters'); test("adpters is declared", function() { ok(adapters !== undefined); }); ``` I can build an example project and send it if you want. Thanks!

Viewing all articles
Browse latest Browse all 1864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>