qunitjs/node-qunit

Add support for setting module from commandline

Closed this issue · 2 comments

Hi, I find this library very useful for running javascript unit tests. However, I had to do some ugly stuff to get it working for my situation:

To run all tests in specific directory against corresponding JS files:

https://github.com/frontlinesms/frontlinesms2/blob/master/plugins/frontlinesms-core/do/js_unit_test

To parse output of node-qunit and convert it to JUnit XML reports (for use with Jenkins):

https://github.com/frontlinesms/frontlinesms2/blob/master/plugins/frontlinesms-core/do/js_unit_test_xml

One thing that would make life easier in my situation would be to be able to set the equivalent of QUnit.module("some-module-name") as a commandline arg, e.g.

qunit -t mytest.js -m mytest

where -m <somename> sets the module name

Anyway, thanks for a great lib and let me know if I'm missing anything obvious.

kof commented
  1. Well, there are a lot of strategies for structuring files, it depends on the architecture of a product, I don't want to force someone using one of them, therefor one will need either to write a files finder or reference them manually in some config file. It is possible to make this less ugly f.e. by using node-qunit js api directly without cli. Write your own bin/testrunner.js script and pass the files from there. Also you can use some high level nodejs modules to find your files.
  2. #17 #73 issues are about export.
  3. Why do you want to set the module name from outside of the module. Normally your module should know its name or it will be auto detected using file name.

Hi kof, your suggestion to write a JS file finder sounds like the neatest way to solve this. Thanks for the feedback.