Skip to content

Commit 1bbe41a

Browse files
Copiloticlanton
andcommitted
feat(heft-jest-plugin): Add heft-jest CLI wrapper for VSCode Jest extension integration
Co-authored-by: iclanton <[email protected]>
1 parent fbd54dd commit 1bbe41a

File tree

7 files changed

+548
-14
lines changed

7 files changed

+548
-14
lines changed

common/config/subspaces/build-tests-subspace/pnpm-lock.yaml

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "e12ac931528bca6b851ff4e4bbe8df7c7463449c",
3+
"pnpmShrinkwrapHash": "54cea496681584cbbaed2572d3fbe0b8190a01e5",
44
"preferredVersionsHash": "550b4cee0bef4e97db6c6aad726df5149d20e7d9",
5-
"packageJsonInjectedDependenciesHash": "10959d629cddc9df960467f98e5cf3982e69f38d"
5+
"packageJsonInjectedDependenciesHash": "ee2b3b71bdf017198644d741cf5152fa01ff931b"
66
}

heft-plugins/heft-jest-plugin/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,53 @@
22

33
This is a Heft plugin for running Jest.
44

5+
## VSCode Jest Extension Integration
6+
7+
This package includes a `heft-jest` CLI wrapper that enables integration with the
8+
[VSCode Jest extension](https://github.com/jest-community/vscode-jest). The wrapper translates
9+
Jest CLI parameters to Heft CLI parameters, allowing the extension to work with Heft's test
10+
runner.
11+
12+
### Setup
13+
14+
To use the VSCode Jest extension with Heft, configure the extension's `jest.jestCommandLine`
15+
setting in your VSCode workspace settings (`.vscode/settings.json`):
16+
17+
```json
18+
{
19+
"jest.jestCommandLine": "npx heft-jest"
20+
}
21+
```
22+
23+
Or, if you have `@rushstack/heft-jest-plugin` installed globally or linked:
24+
25+
```json
26+
{
27+
"jest.jestCommandLine": "heft-jest"
28+
}
29+
```
30+
31+
### How It Works
32+
33+
The `heft-jest` CLI accepts Jest CLI parameters commonly sent by the VSCode Jest extension and
34+
translates them to equivalent Heft parameters. For example:
35+
36+
| Jest Parameter | Heft Parameter |
37+
|----------------|----------------|
38+
| `--testPathPattern` | `--test-path-pattern` |
39+
| `--testNamePattern` or `-t` | `--test-name-pattern` |
40+
| `--updateSnapshot` or `-u` | `--update-snapshots` |
41+
| `--maxWorkers` | `--max-workers` |
42+
| `--testTimeout` | `--test-timeout-ms` |
43+
| `--no-coverage` | `--disable-code-coverage` |
44+
| `--detectOpenHandles` | `--detect-open-handles` |
45+
| `--silent` | `--silent` |
46+
| `--logHeapUsage` | `--log-heap-usage` |
47+
| `--watchAll` / `--watch` | Uses `heft test-watch` instead of `heft test` |
48+
49+
Parameters specific to the VSCode Jest extension (like `--json`, `--outputFile`, `--reporters`)
50+
are automatically filtered out.
51+
552
## Links
653

754
- [CHANGELOG.md](
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
require('../lib/heft-jest-cli.js');

heft-plugins/heft-jest-plugin/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
},
1010
"homepage": "https://rushstack.io/pages/heft/overview/",
1111
"license": "MIT",
12+
"bin": {
13+
"heft-jest": "./bin/heft-jest"
14+
},
1215
"scripts": {
1316
"build": "heft test --clean",
1417
"start": "heft build-watch",

0 commit comments

Comments
 (0)