headlamp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/cli.js +8245 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.js +8395 -0
- package/dist/index.js.map +7 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Piper
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Headlamp
|
|
2
|
+
|
|
3
|
+
Coverage-first, runner-agnostic test UX for Jest. Headlamp delegates test execution to your existing runner and focuses on clearer selection and better coverage insights.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -D headlamp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx headlamp --coverage [jest args]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- Uses your local Jest install; pass your normal flags after `headlamp`
|
|
18
|
+
- Renders improved coverage tables and hotspots in the terminal
|
|
19
|
+
- Select files via CLI args; Headlamp smartly chooses tests to run and what coverage to show
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- Coverage-first terminal UI: per-file summaries, hotspots, missed functions/branches, editor links
|
|
24
|
+
- Intelligent selection:
|
|
25
|
+
- Provide production paths; Headlamp finds direct tests by import graph
|
|
26
|
+
- Falls back to resilient discovery when Jest listing times out
|
|
27
|
+
- Alias-aware import resolution: tsconfig/jsconfig paths, Jest moduleNameMapper, Babel module-resolver, Metro extraNodeModules
|
|
28
|
+
- Zero lock-in: delegates to Jest; Vitest support is planned but not required to use coverage UI
|
|
29
|
+
|
|
30
|
+
## CLI flags (selected)
|
|
31
|
+
|
|
32
|
+
- `--coverage`: enable coverage collection and UI
|
|
33
|
+
- `--coverage-ui=jest|both`: choose minimal (jest) or extended (both) coverage UI
|
|
34
|
+
- `--coverage.detail=<n|all|auto>`: deep-dive per-file hotspots (n = count)
|
|
35
|
+
- `--coverage.showCode=true|false`: show snippet around hotspots
|
|
36
|
+
- `--coverage.mode=compact|full|auto`: compact table vs full per-file details
|
|
37
|
+
- `--coverage.maxFiles`, `--coverage.maxHotspots`: limit rows to fit your terminal
|
|
38
|
+
- `--coverage.pageFit=true|false`: adapt output to terminal rows
|
|
39
|
+
|
|
40
|
+
Pass all your regular Jest flags (e.g. `-t`, `--testNamePattern`, paths). Headlamp strips/adjusts coverage-related flags when listing tests.
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
- Show coverage with detailed hotspots, auto-fit to terminal rows:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx headlamp --coverage
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- Focus on specific production files and run only directly-related tests:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx headlamp --coverage src/services/user.ts src/components/UserCard.tsx
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Editor links
|
|
57
|
+
|
|
58
|
+
Headlamp prints clickable links (OSC 8) to open files at hotspots. Set `--coverage.editor` to override the default editor URL template if needed.
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
You can import pieces programmatically:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { printCompactCoverage, resolveImportWithRoot } from "headlamp";
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Status
|
|
69
|
+
|
|
70
|
+
Alpha. Expect changes. Feedback welcome.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|