jest-docblock-runner

Run specific Jest tests by tagging your tests with docBlock pragmas.


Keywords
jest, tag, runner, docBlock, pragma, circus, collect, docblock-pragmas, extend-jest, filter, group-testing, jest-circus, jest-docblock-runner, jest-tests, manage, test, test-case
License
MIT
Install
npm install jest-docblock-runner@1.3.5

Documentation

jest-docblock-runner

Lint-Build-Test-Publish XO code style semantic-release License: MIT

Run Jest tests by docBlock pragmas like those used in jest-circus-allure-environment

🚧 This is currently under development. 🚧

âž• Jest patches

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:

npx patch-package --patch-dir="./node_modules/jest-docblock-runner/patches"

🚀 Quick start

  1. Add dependency to project
yarn add --dev jest-docblock-runner
  1. Apply the patches to jest-circus, jest-jasmine2, jest-types, and jest-runner
npx patch-package --patch-dir="./node_modules/jest-docblock-runner/patches"
  1. Update Jest configuration:

See Jest documentation for more information.

// Jest.config.js

{
  ...
  "runner": "jest-docblock-runner"
}
  1. Add DocBlocks with pragmas to your tests
// example.test.js
test('bank records update, when I withdraw $100 USD', () => {
  /**
   * @severity critical
   */

  ...
})
  1. Run only the marked tests
yarn run jest --severity=critical

Note: This will accept comma separated values and/or multiple flags.

TODO: