Commit 754d3ea
test(utils): add unit coverage for trace.js + safeStringify extensions + truncateString
49 new test cases across two files:
- `test/unit/utils/trace_test.js` (new, 37 cases) — direct coverage of
every export from `lib/utils/trace.js`:
- `pickActingHelper` (all 3 paths)
- `traceDirFor` (determinism, uniqueness, sanitization, missing args)
- `snapshotDirFor` (uniqueness, embedded timestamp)
- `artifactLinks` (each artifact, console-count override, storage
counts, custom indent, empty input, ordering invariant)
- `fileToUrl` / `artifactsToFileUrls`
- `writeTraceMarkdown` (golden output, error block, optional commands,
default `file`)
- `captureSnapshot` (default options, full opt-out matrix, fullPage,
formatHtml integration, ConsoleMessage normalization, Playwright
grabStorageState path, Puppeteer/WebDriver fallback path, empty
storage handled, missing helper methods, error swallowing, default
prefix)
- `test/unit/circular_reference_test.js` (extended, 12 new cases):
- `safeStringify` Function/BigInt/Symbol/Error coercions including
nested mixed types (BigInt was a real bug; JSON.stringify(BigInt)
used to throw and trigger the legacy fallback path)
- `truncateString` under / equal / over maxBytes, non-string coercion,
empty string
Total unit suite: 121 passing (was 72).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent eaca22d commit 754d3ea
2 files changed
Lines changed: 516 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
163 | 260 | | |
164 | 261 | | |
165 | 262 | | |
| |||
0 commit comments