I'm trying to execute just a subset of my node jasmine tests.
I have a project structure as follows
root
+ server
+ invite
+specs
inviteSendSpec.js
inviteConfirmSpec.js
.. many more spec files
+ auth
+specs
.. many spec files
I can execute all tests from root by running:
node-jasmine --verbose server/
I'm trying to figure out how to use the -m parameter, so that I can just run the test matching a certain file name pattern.
e.g.
node-jasmine --verbose -m invite server/
should run all tests which contain invite, according to the few examples I've found. But instead it just finds one single test.
If I try to run a similar variation e.g.
node-jasmine --verbose -m send server/
it will find no tests.
What is the correct syntax for selecting a subset of tests?
p.s. I'm running jasmine-node 11.1.0 (so its not the walkdir issue)
-m or --match parameter is indeed used for file name matching.
I banged my had against the keyboard for couple of hours, and ended up looking at source for cli.js.
So here is the ticket (cli.js, line 228):
var regExpSpec = new RegExp(match + (matchall ? "" : "spec\\.") + "(" + extensions + ")$", 'i')
Aha!
First, you MUST specify --matchall key, otherwise it will use default "spec" prefix.
Second, there is no way you can specify extensions, they are either js or js|coffee|litcoffee if you use --coffee command line parameter
My test files have unit.js suffix (do not ask why), so I ended up with
cli.js --verbose --matchall --match unit\. --test-dir C:\MyProject\
and it did the job.