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 had the same issue and followed the same path. In my case, I wrote the tests with typescript using AMD modules, so I had to replace 'import ...' with requires inside the tests, which I have to say it's a bit uglier. I was able to run the tests using 'import....' without issues from a QUnit web page directly, since they are run once the imports are resolved, but I didn´t have luck with Chutzpah. I also needed using my require.JS config file for declared shims, so I needed additional wrapping to make it work with Chutzpah. I don´t know the internals at all, but would it be possible to drive the test discovery/running using an already working QUnit HTML file that imports the tests or the like? I suppose that the tests are included asynchronously when using require.JS complicate things a little though.

Viewing all articles
Browse latest Browse all 1864

Trending Articles



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