You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(tests): optimize test suite and improve documentation
- Create test/utils/assertions.mts with reusable helpers
- Consolidate duplicate test patterns (length validation, encoding)
- Extract global-mocking test to isolated config for safe concurrency
- Add vitest config documentation for standard vs isolated tests
- Update CLAUDE.md with test naming conventions
- Improve docs with visual aids and critical-info-first structure
Reduces test duplication by ~900 lines, maintains 100% coverage, and
enables safe concurrent execution for 99.75% of tests (867/868).
Copy file name to clipboardExpand all lines: CLAUDE.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,15 +173,40 @@ With `exactOptionalPropertyTypes`, assign conditionally:
173
173
174
174
### Testing
175
175
176
-
**Vitest Configuration**: This repo uses the shared vitest configuration patterns documented in `../socket-registry/CLAUDE.md` (see "Vitest Configuration Variants" section). Three configs available:
177
-
-`.config/vitest.config.mts` - Main config (default)
178
-
-`.config/vitest.config.isolated.mts` - Full process isolation for vi.doMock()
176
+
**Vitest Configuration**: This repo uses the shared vitest configuration patterns documented in `../socket-registry/CLAUDE.md` (see "Vitest Configuration Variants" section). Two configs available:
177
+
-`.config/vitest.config.mts` - Main config (threads, isolate: false, concurrent: true)
178
+
-`.config/vitest.config.isolated.mts` - Full process isolation (forks, isolate: true)
179
+
180
+
#### Test File Naming Conventions
181
+
🚨 **MANDATORY** - Use correct suffix based on isolation requirements:
182
+
183
+
**Standard tests** (`*.test.mts`):
184
+
- Run with thread pool, shared worker context
185
+
- Fast execution, parallel within suites
186
+
- Most tests should use this pattern
187
+
- Example: `test/package-url.test.mts`
188
+
189
+
**Isolated tests** (`*.isolated.test.mts`):
190
+
- Run with fork pool, full process isolation
191
+
- Required for tests that:
192
+
- Mock global objects (global.URL, global.process, etc.)
193
+
- Use vi.doMock() for dynamic module mocking
194
+
- Would cause race conditions in concurrent execution
195
+
- Automatically detected and run separately by `scripts/test.mjs`
Copy file name to clipboardExpand all lines: README.md
+31-5Lines changed: 31 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,31 @@
8
8
9
9
TypeScript Package URL (purl) parser and builder. Drop-in replacement for [`packageurl-js`](https://socket.dev/npm/package/packageurl-js) with full type safety, zero dependencies, and spec compliance with the [Package URL specification](https://github.com/package-url/purl-spec).
10
10
11
+
## What is a PURL?
12
+
13
+
A Package URL (purl) standardizes how to identify software packages:
0 commit comments