It seems to me that you are doing this for the page that you load in your browser to launch Mocha. To do this, in the browser, you can pass these parameters to the URL of the page:
grep
, which roughly matches the --grep
option on the command line. This narrows down the tests executed for those that match the expression passed in grep
. However, at present (even as of version 2.0.1) there is no way to force Mocha to interpret this parameter as a regular expression. It is always interpreted as a string. Thatβs why I said βroughly matches.β --grep
on the command line is a regular expression, but the grep
parameter passed in the url is a string.
invert
that match the --invert
option on the command line. This inverts the match executed with grep
and thus selects those tests that do not match grep
.
So, if you open the page by adding the following line ?grep=(slow)&invert=1
, it will run tests that do not have the line "(slow)"
.
Louis source share