{"_id":"@arut.ji/jest-runner-groups","_rev":"3-851d68076fe97f56037a77294734311d","name":"@arut.ji/jest-runner-groups","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@arut.ji/jest-runner-groups","version":"1.0.0","keywords":["jest","jest-runner","groups"],"author":{"name":"Arut Jinadit","email":"arut.jinadit@gmail.com"},"license":"MIT","_id":"@arut.ji/jest-runner-groups@1.0.0","maintainers":[{"name":"arut.ji","email":"arut.jinadit+npm@gmail.com"}],"homepage":"https://github.com/arut-ji/jest-runner-groups#readme","bugs":{"url":"https://github.com/arut-ji/jest-runner-groups/issues"},"dist":{"shasum":"722abcf6db01ab996bc2c9072fca294c3ef1f535","tarball":"https://registry.npmjs.org/@arut.ji/jest-runner-groups/-/jest-runner-groups-1.0.0.tgz","fileCount":5,"integrity":"sha512-6DHHEWdZEsk5aCZBuGm7yEyCaulW4uu2WQKhY9zBd61HoybZcJvpnfGHbpkKBA7BbcTz1dMb4Tnpyt8x2Gmc9w==","signatures":[{"sig":"MEUCIBCohlcSOIuerP4csTL5Err1MnPmXB4fIpoUm5m3n3JVAiEAuEQpvi1UvlMeOEt+7BBMy92a1fID47Ah6WuxhE6HwPY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11310},"main":"./dist/index.mjs","type":"module","_from":"file:arut.ji-jest-runner-groups-1.0.0.tgz","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">= 18.0.0"},"exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"scripts":{"dev":"tsdown --watch","test":"vitest","build":"tsdown","typecheck":"tsc --noEmit","publish:dry-run":"pnpm publish --dry-run --access public"},"_npmUser":{"name":"arut.ji","email":"arut.jinadit+npm@gmail.com"},"_resolved":"/private/var/folders/p0/zg0q775j6tl7bx6v_c34wsr40000gp/T/79f648bbd300ac80f72cfe80b8e594b1/arut.ji-jest-runner-groups-1.0.0.tgz","_integrity":"sha512-6DHHEWdZEsk5aCZBuGm7yEyCaulW4uu2WQKhY9zBd61HoybZcJvpnfGHbpkKBA7BbcTz1dMb4Tnpyt8x2Gmc9w==","repository":{"url":"git+https://github.com/arut-ji/jest-runner-groups.git","type":"git"},"_npmVersion":"11.6.1","description":"Tag and run groups of tests with Jest","directories":{},"_nodeVersion":"24.11.0","_hasShrinkwrap":false,"devDependencies":{"bumpp":"^10.3.1","tsdown":"^0.16.4","vitest":"^4.0.9","typescript":"^5.9.3","@types/node":"^24.10.1","jest-runner":"^30.0.0"},"peerDependencies":{"jest-runner":">= 30"},"_npmOperationalInternal":{"tmp":"tmp/jest-runner-groups_1.0.0_1763891493428_0.8122542707634577","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arut.ji/jest-runner-groups","version":"1.0.1","keywords":["jest","jest-runner","groups"],"author":{"name":"Arut Jinadit","email":"arut.jinadit@gmail.com"},"license":"MIT","_id":"@arut.ji/jest-runner-groups@1.0.1","maintainers":[{"name":"arut.ji","email":"arut.jinadit+npm@gmail.com"}],"homepage":"https://github.com/arut-ji/jest-runner-groups#readme","bugs":{"url":"https://github.com/arut-ji/jest-runner-groups/issues"},"dist":{"shasum":"5d6e658c93593dfb947a9a09666745d094940c3a","tarball":"https://registry.npmjs.org/@arut.ji/jest-runner-groups/-/jest-runner-groups-1.0.1.tgz","fileCount":5,"integrity":"sha512-2UMrfpZkUbhkVWllMJLBEsJVfCM+56Aaw2FnHp5HMQtUQsoXI6y+yL/33GD8Ulc2Q7dn0e21LA/b8XhASHjVVQ==","signatures":[{"sig":"MEQCIDQYp5PyfM2FFQlYdcmx4DUUlGGkYHE0C4EJaMaXe6YwAiALKEfwGd869cQajs1FKCT0+vPzk9Zwgx3Kx93LCiLE3w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11549},"main":"./dist/index.mjs","type":"module","_from":"file:arut.ji-jest-runner-groups-1.0.1.tgz","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">= 18.0.0"},"exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"scripts":{"dev":"tsdown --watch","test":"vitest","build":"tsdown","typecheck":"tsc --noEmit","publish:dry-run":"pnpm publish --dry-run --access public"},"_npmUser":{"name":"arut.ji","email":"arut.jinadit+npm@gmail.com"},"_resolved":"/private/var/folders/p0/zg0q775j6tl7bx6v_c34wsr40000gp/T/2836f9b89d9b7475f31f74893071e0eb/arut.ji-jest-runner-groups-1.0.1.tgz","_integrity":"sha512-2UMrfpZkUbhkVWllMJLBEsJVfCM+56Aaw2FnHp5HMQtUQsoXI6y+yL/33GD8Ulc2Q7dn0e21LA/b8XhASHjVVQ==","repository":{"url":"git+https://github.com/arut-ji/jest-runner-groups.git","type":"git"},"_npmVersion":"11.6.1","description":"Tag and run groups of tests with Jest","directories":{},"_nodeVersion":"24.11.0","_hasShrinkwrap":false,"devDependencies":{"bumpp":"^10.3.1","tsdown":"^0.16.4","vitest":"^4.0.9","typescript":"^5.9.3","@jest/types":"^30.2.0","@types/jest":"^30.0.0","@types/node":"^24.10.1","jest-runner":"^30.0.0","jest-watcher":"^30.2.0","@jest/test-result":"^30.2.0"},"peerDependencies":{"jest-runner":">= 30"},"_npmOperationalInternal":{"tmp":"tmp/jest-runner-groups_1.0.1_1763892467059_0.3884772798842582","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@arut.ji/jest-runner-groups","version":"1.0.2","description":"Tag and run groups of tests with Jest","type":"module","license":"MIT","homepage":"https://github.com/arut-ji/jest-runner-groups#readme","bugs":{"url":"https://github.com/arut-ji/jest-runner-groups/issues"},"repository":{"type":"git","url":"git+https://github.com/arut-ji/jest-runner-groups.git"},"author":{"name":"Arut Jinadit","email":"arut.jinadit@gmail.com"},"keywords":["jest","jest-runner","groups"],"main":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"engines":{"node":"^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"},"peerDependencies":{"jest-runner":">= 30"},"devDependencies":{"@jest/test-result":"^30.2.0","@jest/types":"^30.2.0","@types/jest":"^30.0.0","@types/node":"^24.10.1","bumpp":"^10.3.1","jest-runner":"^30.0.0","jest-watcher":"^30.2.0","tsdown":"^0.16.4","typescript":"^5.9.3","vitest":"^4.0.9"},"scripts":{"build":"tsdown","dev":"tsdown --watch","test":"vitest","typecheck":"tsc --noEmit","publish:dry-run":"pnpm publish --dry-run --access public"},"_id":"@arut.ji/jest-runner-groups@1.0.2","_integrity":"sha512-WCbXDph3UPglEZcP+S4MS7zGwDv4MK1Heiw0G9//G+JyLgJ2kECSQzA4+AuTxNfSW0lkWQmALU6CqcpVpF/gUg==","_resolved":"/private/var/folders/p0/zg0q775j6tl7bx6v_c34wsr40000gp/T/db230950b67578e06437e5228c5a2f55/arut.ji-jest-runner-groups-1.0.2.tgz","_from":"file:arut.ji-jest-runner-groups-1.0.2.tgz","_nodeVersion":"25.0.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-WCbXDph3UPglEZcP+S4MS7zGwDv4MK1Heiw0G9//G+JyLgJ2kECSQzA4+AuTxNfSW0lkWQmALU6CqcpVpF/gUg==","shasum":"978d22c1097e83b99119232d560ed91261db6c68","tarball":"https://registry.npmjs.org/@arut.ji/jest-runner-groups/-/jest-runner-groups-1.0.2.tgz","fileCount":5,"unpackedSize":11611,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDqE4ePWg4Cqfj+BjLGb8KBUpXxPqOv/pCLE7FzmDjacAiEAioJuHx7b0fvpktaeLEQYnlhCU1OLLj+oYkTzb80VeRg="}]},"_npmUser":{"name":"arut.ji","email":"arut.jinadit+npm@gmail.com"},"directories":{},"maintainers":[{"name":"arut.ji","email":"arut.jinadit+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/jest-runner-groups_1.0.2_1763892768742_0.18765109567906424"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-23T09:51:33.324Z","modified":"2025-11-23T10:12:49.183Z","1.0.0":"2025-11-23T09:51:33.635Z","1.0.1":"2025-11-23T10:07:47.276Z","1.0.2":"2025-11-23T10:12:48.972Z"},"bugs":{"url":"https://github.com/arut-ji/jest-runner-groups/issues"},"author":{"name":"Arut Jinadit","email":"arut.jinadit@gmail.com"},"license":"MIT","homepage":"https://github.com/arut-ji/jest-runner-groups#readme","keywords":["jest","jest-runner","groups"],"repository":{"type":"git","url":"git+https://github.com/arut-ji/jest-runner-groups.git"},"description":"Tag and run groups of tests with Jest","maintainers":[{"name":"arut.ji","email":"arut.jinadit+npm@gmail.com"}],"readme":"# @arut.ji/jest-runner-groups\n\n[![Version](https://img.shields.io/npm/v/@arut.ji/jest-runner-groups.svg)](https://www.npmjs.com/package/@arut.ji/jest-runner-groups)\n[![License](https://img.shields.io/npm/l/@arut.ji/jest-runner-groups.svg)](https://github.com/arut-ji/jest-runner-groups/blob/master/package.json)\n\nA test runner that allows you to tag your tests and execute specific groups of tests with Jest.\n\n## Installation\n\n```sh-session\nnpm i -D @arut.ji/jest-runner-groups\n```\n\n## Requirements\n\n- Jest 30 or higher\n- Node.js 18.14.0 or higher (or 20.x, 22.x, or 24+)\n\n## Usage\n\nTo use this runner you need to tag your tests, add this runner to your jest config and update your test command to specify which groups to run.\n\n### Tag your tests\n\nTo properly tag your tests, you need to add a docblock with the `@group` tag to every test file you have. For example, your test should look like the following to belong to the `unit/classes/foo` group:\n\n```javascript\n/**\n * Tests Foo class\n *\n * @group unit/classes/foo\n */\n\nimport Foo from '../src/Foo';\n\ndescribe('Foo class', () => {\n    it('...', () => {\n        ...\n    });\n\n    ...\n});\n```\n\nYour tests may have multiple groups per file:\n\n```javascript\n/**\n * Admin dashboard tests\n *\n * @group admin/pages/dashboard\n * @group puppeteer\n * @group acceptance\n */\n\ndescribe('Dashboard page', () => {\n    ...\n});\n```\n\n### Update Jest config\n\nTo make Jest use this runner, you need to update your Jest config and add `@arut.ji/jest-runner-groups` runner to it. For example, if your jest config is in the `package.json` file:\n\n```json\n{\n  \"name\": \"my-package\",\n  \"version\": \"1.0.0\",\n  \"jest\": {\n    \"runner\": \"@arut.ji/jest-runner-groups\"\n  }\n}\n```\n\nOr in the `jest.config.js` file:\n\n```javascript\nmodule.exports = {\n    ...\n    runner: \"@arut.ji/jest-runner-groups\"\n};\n```\n\nOr in the `jest.config.ts` file (TypeScript):\n\n```typescript\nimport type { Config } from 'jest';\n\nconst config: Config = {\n    ...\n    runner: \"@arut.ji/jest-runner-groups\"\n};\n\nexport default config;\n```\n\n> Note: There is a confusion between [runner](https://jestjs.io/docs/en/configuration#runner-string) and [testRunner](https://jestjs.io/docs/en/configuration#testrunner-string) options in the jest configuration. The main difference between them is that jest uses `runner` to find and execute all tests, and `testRunner` to execute a particular test file. So, if you want to use `jest-circus`, then add it as `testRunner` along with `\"runner\": \"@arut.ji/jest-runner-groups\"` option and they will work together.\n\n### Run groups of tests\n\nOnce you update your tests and jest config, you can start running tests in groups by using `--group` argument. Just specify a group or groups that you want to run like this:\n\n```sh-session\n// using jest executable:\njest --group=unit\n\n// or via npm:\nnpm test -- --group=unit\n```\n\nYou can use multiple `--group` arguments to specify multiple groups to run:\n\n```sh-session\nnpm test -- --group=unit/classes --group=unit/services\n```\n\nAlso pay attention that if you specify a prefix of a group, then all tests that have a group that starts with that prefix will be executed. In other words, if you run `npm test -- --group=unit` command, then all tests that have a group that starts with `unit` will be executed.\n\n### Exclude groups\n\nIf you want to exclude a subgroup from being executed, add minus character to the beginning of its name. The following example shows how to run all tests in the `foo` group, but exclude `foo/baz` group:\n\n```sh-session\njest --group=foo --group=-foo/baz\n```\n\n### Knowing which groups are running\n\nWhen you run your tests using @arut.ji/jest-runner-groups, you can check which group is currently running by checking the current process environment variables. This can be handy if you want to use different fixtures for different groups or skip a certain functionality for a specific group.\n\nEach group is added with the `JEST_GROUP_` prefix and all non-word characters in the group name are replaced with underscores. For example, if you run the following command:\n\n```sh-session\nnpm test -- --group=unit/classes --group=unit/services\n```\n\nThen you can check groups in your jest tests:\n\n```js\n/**\n * Admin dashboard tests\n *\n * @group unit/classes\n * @group unit/services\n * @group unit/utility\n */\n\nit(\"...\", () => {\n  expect(process.env.JEST_GROUP_UNIT_CLASSES).toBeTruthy();\n  expect(process.env.JEST_GROUP_UNIT_SERVICES).toBeTruthy();\n  expect(process.env.JEST_GROUP_UNIT_UTILITY).not.toBeTruthy();\n});\n```\n\n## Migration from jest-runner-groups\n\nIf you're migrating from the original `jest-runner-groups` package:\n\n1. Update your package name in `package.json`:\n\n   ```json\n   {\n     \"devDependencies\": {\n       \"@arut.ji/jest-runner-groups\": \"^1.0.0\"\n     }\n   }\n   ```\n\n2. Update your Jest configuration to use the new package name:\n\n   ```json\n   {\n     \"jest\": {\n       \"runner\": \"@arut.ji/jest-runner-groups\"\n     }\n   }\n   ```\n\n3. Ensure you're using Jest 30 or higher (this package requires Jest 30+)\n\n## Changes from v3.x\n\n- **TypeScript implementation**: The package is now written in TypeScript with full type definitions\n- **Jest 30+ required**: This version requires Jest 30 or higher\n- **No jest-docblock dependency**: The package now includes its own docblock parser, removing the need for `jest-docblock` as a peer dependency\n- **ESM support**: The package is built as an ES module\n\n## Contribute\n\nWant to help or have a suggestion? Open a [new ticket](https://github.com/arut-ji/jest-runner-groups/issues/new) and we can discuss it or submit a pull request.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}