Run specific Jest tests by tagging your tests with docBlock pragmas.
npm install jest-docblock-runner

!Lint-Build-Test-Publish



Run Jest tests by docBlock pragmas like those used in jest-circus-allure-environment
🚧 This is currently under development. 🚧
This project is contingent on code changes to be approved and merged into the Jest project. For now I've implemented a workaround that applies patches to the Jest dependencies using patch-package. This should happen automatically after installing the dependencies with yarn install /npm install.
If for some reason the patches were not applied automatically you can apply them by running:
``shell`
npx patch-package --patch-dir="./node_modules/jest-docblock-runner/patches"
1. Add dependency to project
`shell`
yarn add --dev jest-docblock-runner
2. Apply the patches to jest-circus, jest-jasmine2, jest-types, and jest-runner
`shell`
npx patch-package --patch-dir="./node_modules/jest-docblock-runner/patches"
3. Update Jest configuration
_See the Jest documentation for more information._
`js
// Jest.config.js
{
...
"runner": "jest-docblock-runner"
}
`
4. Add DocBlock pragmas to your tests
`js
// example.test.js
test('bank records update, when I withdraw $100 USD', () => {
/**
* @severity critical
*/
...
})
`
4. Run specific marked tests
`shell``
yarn run jest --severity=critical
_Note: This will accept comma separated values and/or multiple flags._
- [ ] Get this Jest PR merged or work with the Jest team to implement another solution that resolves this issue.
- [ ] Add support for describe blocks.
- [ ] Reach 100% code coverage.