With https://github.com/LiskHQ/lisk/pull/2934, we are introducing jest to our codebase. Running jest as a grunt task creates unintended output and suppresses jest's output colorisation.
That's why the best way to execute test runners is to just use npm scripts. We are going to use npm scripts to run jest tests. In order to align with that, we need to update the way we are running mocha tests.
This will also give developers more flexibility to run tests.
General command structure will look like this.
npm run mocha:<testType> -- [filepath] [mocha-options]
Where testType can be;
The commands will change as below
# Running network tests
npm run mocha:network
npm run mocha:network -- --grep @p2p
npm run mocha:network -- --grep @propagation
# Running unit tests
npm run mocha:unit
npm run mocha:unit -- --grep @slow
npm run mocha:unit -- --grep @unstable
npm run mocha:unit -- --grep @sequential
### extensive
npm run mocha:unit -- --grep="@unstable|@sequential" --invert
# Running Integration tests
npm run mocha:integration -- --grep @slow
npm run mocha:integration -- --grep @unstable
npm run mocha:integration -- --grep @sequential
# extensive
npm run mocha:integration -- --grep="@unstable|@sequential" --invert
# Running functional tests
npm run mocha:functional:ws
npm run mocha:functional:get
npm run mocha:functional:post
Running single file can be done by running the command below
npm run mocha:unit -- <filepath> [mocha-options]
Also, using command below still will be possible.
npx mocha <filepath>
We are using grunt to execute our test suites at the moment, but this can be simply done by npm scripts.
1.6.0
@fchavant Could you please take a look to this issue and let me know if you see any problem with the suggested changes?
@yatki looks good to me, I'm glad we're getting rid of the Gruntfile even
Most helpful comment
@yatki looks good to me, I'm glad we're getting rid of the
Gruntfileeven