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
* feat: set test.status to running in onStart callback
Enables twd-js to find the currently executing test by scanning
handlers for status === 'running' during mock collection.
* feat: add buildTestPath utility
Walks the handler parent chain to build a full test path string
like 'Cart > Checkout > should submit order' from a testId.
* feat: fix mock dedup key and add occurrence tracking
Change mock collection key from alias to method:url:status:testId:occurrence.
Track occurrence count per alias:testId combination.
Enrich collected mocks with full test path names from handlers.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add formatMockLabel utility for report display
Formats mock labels with alias, ordinal occurrence suffix (2nd, 3rd),
and test name context for contract validation reports.
* feat: show test name and occurrence in console contract report
Use formatMockLabel to display test context and ordinal occurrence
in error, pass, and warning lines.
* feat: show test name and occurrence in markdown contract report
Use formatMockLabelMd to display test context and ordinal occurrence
in the failure details section of the markdown report.
* docs: update README with test context in contract reports
Update contract validation example output to show test name and
occurrence count in mock labels. Add note about automatic handling
of mock overlaps (same alias, different endpoints).
* chore: update dependencies
* fix: reset test.status and pass testName/occurrence through validation
Two bugs prevented test names from showing in contract reports:
1. onStart set test.status="running" but never reset it, so
__twdCollectMock always found the first test as "running"
2. validateMocks didn't forward testName/occurrence to result objects
Also bump test-example-app twd-js to ^1.6.5 (sends testId).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,8 @@ Create a `twd.config.json` file in your project root:
60
60
61
61
**Important**: Puppeteer is **not** used as a testing framework here. It simply provides a headless browser to load your application — the same way a user would open Chrome. Once the page loads, all test execution happens inside the real browser context through the [TWD runner](https://brikev.github.io/twd/). Your tests interact with real DOM, real components, and real browser APIs — Puppeteer just opens the door and gets out of the way.
62
62
63
+
**Contract Validation**: Mock overlaps are automatically handled — if multiple tests or calls use the same alias but with different HTTP methods/URLs/statuses, all are validated separately (no silent drops).
64
+
63
65
1. Launches a headless browser via Puppeteer (the only thing Puppeteer does)
64
66
2. Navigates to your dev server URL
65
67
3. Waits for the app and TWD sidebar to be ready
@@ -188,12 +190,12 @@ Validate your test mocks against OpenAPI specs to catch drift between your mocks
188
190
```
189
191
Source: ./contracts/users-3.0.json ERROR
190
192
191
-
✓ GET /users (200) — mock "getUsers"
192
-
✗ GET /users/{userId} (200) — mock "getUserBadAddress"
193
+
✓ GET /users (200) — mock "getUsers" — in "UserList > should display all users"
194
+
✗ GET /users/{userId} (200) — mock "getUserBadAddress" — in "UserDetails > should fetch user details"
0 commit comments