Closed ikr0m closed 6 years ago
Single files are not possible, but single directories. See this sample: https://github.com/codeforequity-at/testmybot/tree/master/samples/utterances
spec-folder contains three spec.js files, each pointing to another directory, starting jest pointing to just one of the files will run only testcases from single directory.
the sample is for jest, but can be easily adapted to mocha.
I'm not sure you're planning to add this feature but it's really necessary in real testing. Now I have got many tests and running all of them is not desired because it takes many minutes to finish all tests and it shortens my IBM Watson API calls. I keep only one file in directory and run tests. But it's not convenient to do manually.
You could use --grep
parameter of mocha:
node node_modules/mocha/bin/mocha spec/ --exit --grep=name-fragment
More about grep: http://www.petecorey.com/blog/2016/07/25/mochas-grep-flag/
Nice hint!
@ikr0m is this something you could use for your scenario ?
@Naktibalda @codeforequity-at Thank you guys, it works great! I've run above command in samples/watson folder. Small issue that mochawesome-report is not updated with last run test results. I can see test results in terminal. So far this is ok.
Now I'm running all tests like
npm run test
How can I run single test (single file?