Skip to content

Commit 0b1be8f

Browse files
authored
feat(msw): add @bupkis/msw package for MSW request verification (#346)
Provides natural language assertions for verifying HTTP requests intercepted by [Mock Service Worker](https://npm.im/msw) (MSW): - `TrackedServer` wrapping `SetupServerApi` with request tracking - Path assertions: 'to have handled request to', 'to have handled request matching' - Request options: `method`, `body`, `headers`, `times`, `once` - Body matching uses 'to satisfy' semantics via `expectAsync` - Implements `Disposable` for automatic cleanup with `using` syntax - `waitForBodies()` helper for direct body access
1 parent ae30df2 commit 0b1be8f

File tree

15 files changed

+2657
-10
lines changed

15 files changed

+2657
-10
lines changed

AGENTS.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This is an npm workspaces monorepo. All packages live in `packages/`:
1818
| `@bupkis/events` | `packages/events` | EventEmitter and EventTarget assertions |
1919
| `@bupkis/from-chai` | `packages/from-chai` | Codemod to migrate Chai assertions |
2020
| `@bupkis/from-jest` | `packages/from-jest` | Codemod to migrate Jest/Vitest assertions |
21+
| `@bupkis/msw` | `packages/msw` | MSW request verification assertions |
2122
| `@bupkis/property-testing` | `packages/property-testing` | Property-based testing harness for assertions |
2223
| `@bupkis/rxjs` | `packages/rxjs` | RxJS Observable assertions |
2324
| `@bupkis/sinon` | `packages/sinon` | Sinon spy/stub/mock assertions |
@@ -158,6 +159,16 @@ A codemod tool to migrate Jest and Vitest assertions to bupkis. Supports:
158159
- Negation (`.not``'not to ...'`)
159160
- Both CLI (`bupkis-from-jest`) and programmatic API
160161

162+
### @bupkis/msw (`packages/msw`)
163+
164+
MSW (Mock Service Worker) request verification assertions for bupkis. Provides:
165+
166+
- `createTrackedServer()` - Wraps MSW's `setupServer` with request tracking
167+
- Path assertions (`to have handled request to`, `to have handled request matching`)
168+
- Request options (method, body, headers, times, once)
169+
- Body matching uses "to satisfy" semantics
170+
- Header matching supports exact strings or RegExp patterns
171+
161172
### @bupkis/property-testing (`packages/property-testing`)
162173

163174
Property-based testing harness using fast-check. Provides utilities for systematically testing assertions across four variants: valid, invalid, validNegated, invalidNegated.
@@ -286,7 +297,7 @@ This project uses [Conventional Commits](https://www.conventionalcommits.org/) w
286297

287298
**Commit Format:** `<type>(<scope>): <description>`
288299

289-
- **Scopes** correspond to package names: `bupkis`, `events`, `from-chai`, `from-jest`, `http`, `property-testing`, `rxjs`, `sinon`
300+
- **Scopes** correspond to package names: `bupkis`, `events`, `from-chai`, `from-jest`, `http`, `msw`, `property-testing`, `rxjs`, `sinon`
290301
- **Types** follow a limited set of standard conventions: `feat`, `fix`, `chore`, `docs`
291302

292303
**Cross-Package Changes Require Careful Consideration:**

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
---
1212

13-
This is the monorepo for [**BUPKIS**](https://bupkis.zip), the uncommonly extensible assertion library.
13+
This is the monorepo for [**BUPKIS**][docs], the _uncommonly extensible assertion library._
1414

1515
## Packages
1616

@@ -19,26 +19,34 @@ This is the monorepo for [**BUPKIS**](https://bupkis.zip), the uncommonly extens
1919
### Plugins
2020

2121
- **[@bupkis/events](./packages/events/)** - Event emitter assertions
22-
- **[@bupkis/rxjs](./packages/rxjs/)** - RxJS Observable assertions
23-
- **[@bupkis/sinon](./packages/sinon/)** - Sinon spy/stub/mock assertions
2422
- **[@bupkis/http](./packages/http/)** - HTTP response assertions
23+
- **[@bupkis/msw](./packages/msw/)** - [MSW][] request verification assertions
24+
- **[@bupkis/rxjs](./packages/rxjs/)** - [RxJS][] Observable assertions
25+
- **[@bupkis/sinon](./packages/sinon/)** - [Sinon.JS][] spy/stub/mock assertions
2526

2627
### Migration Tools
2728

28-
- **[@bupkis/from-jest](./packages/from-jest/)** - Codemod to migrate Jest/Vitest assertions to bupkis
29+
- **[@bupkis/from-jest](./packages/from-jest/)** - Codemod to migrate Jest/Vitest assertions to **BUPKIS**
2930

3031
### Testing Tools
3132

32-
- **[@bupkis/property-testing](./packages/property-testing/)** - Property-based testing harness for bupkis assertions
33+
- **[@bupkis/property-testing](./packages/property-testing/)** - Property-based testing harness for **BUPKIS** assertions
3334

3435
## Resources
3536

36-
- [Official Documentation](https://bupkis.zip)
37-
- [npm](https://www.npmjs.com/package/bupkis)
38-
- [GitHub](https://github.com/boneskull/bupkis)
37+
- [Official Documentation][docs]
38+
- **BUPKIS** on [npm][]
39+
- **BUPKIS** on [GitHub][]
3940

4041
## License
4142

42-
Copyright © 2025 [Christopher "boneskull" Hiller][boneskull]. Licensed under [BlueOak-1.0.0](https://blueoakcouncil.org/license/1.0.0).
43+
Copyright © 2025 [Christopher "boneskull" Hiller][boneskull]. Licensed under [BlueOak-1.0.0][].
4344

4445
[boneskull]: https://github.com/boneskull
46+
[MSW]: https://mswjs.io
47+
[RxJS]: https://rxjs.dev
48+
[Sinon.JS]: https://sinonjs.org
49+
[docs]: https://bupkis.zip
50+
[npm]: https://www.npmjs.com/package/bupkis
51+
[GitHub]: https://github.com/boneskull/bupkis
52+
[BlueOak-1.0.0]: https://blueoakcouncil.org/license/1.0.0

0 commit comments

Comments
 (0)