Skip to content

Simple approach to run just the tests you need when building for the CLI #1882

Discussion options

You must be logged in to vote

I'm going about it in two ways:

  1. In package.json, I'm adding a new script that matches only the specific test file, eg. "test:dev": "c8 mocha \"dist/**/Utils.spec.js\"". That way I can have mocha run just these tests, which is pretty fast. One thing you need to keep in mind is that you should remember to remove this script before committing your changes
  2. You can add .only either to the whole suite (describe statement) or a single test (it), eg. describe.only(..... That way mocha will run only this one suite/test. You can add .only to one or multiple tests/suites. One drawback is, that without modifying the test script, mocha will still parse all matching files, but will just run tests flag…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@sebastienlevert
Comment options

@waldekmastykarz
Comment options

@waldekmastykarz
Comment options

@sebastienlevert
Comment options

Answer selected by waldekmastykarz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants