javascript - Running test cases selectively with Mocha -
there total of 20 test case files. want test particular set of 10 test cases. there script file or other method run test cases selectively mocha?
there 2 principal ways specify subset of tests run:
you can give mocha name of file contains tests want run:
$ mocha path/to/file
it possible give paths multiple files if needed. instance, if have 10 test files , want run tests 2 of them, give paths of 2 files.
this method relies on splitting tests separate files according logic suits situation.
you can use
--grep
option:$ mocha --grep pattern
the pattern regular expression mocha use test each test title. each test pattern matches run.
the 2 methods combined run tests match pattern , 1 specific file: $ mocha --grep pattern path/to/file
Comments
Post a Comment