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 looked into this here are my results. If you run the .html directly it works. In the sample you attached it was missing the underscore.js file but when I added it Chutzpah could run the .html fine. If you run the .js it doesn't for a couple reasons 1. You must switch define( to require( 2. You must reference require.js 3. Chutzpah has no no way to define shims Overall, Chutzpah needs to have a better solution for using require.js directly from a JS file but it does work fine from HTML. Let me know what you think.

Viewing all articles
Browse latest Browse all 1864

Trending Articles



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