Commit 54bb9b0
committed
test: add ESM import integration tests for globs module
Add test to verify that Node.js ESM loader can properly import named
exports from esbuild-compiled CommonJS modules. Tests confirm that
esbuild's annotation pattern works correctly.
The test verifies that all exports (glob, globSync, defaultIgnore,
getGlobMatcher) are accessible via ESM import statements.
Note: esbuild generates both:
1. `module.exports = __toCommonJS(...)` for actual exports
2. `0 && (module.exports = {...})` annotation for cjs-module-lexer
The annotation allows Node's ESM loader to detect exports without
executing the code.
test(dlx): add 18 edge case tests to increase coverage
Add comprehensive edge case testing for DLX modules (cache, paths, dir, packages):
generateCacheKey edge cases (7 new tests):
- Empty strings
- Special characters (@#$%^&*...)
- Unicode characters (测试-тест-テスト)
- Very long inputs (10,000 chars)
- URL specs
- Hash collision testing for similar strings
Path function edge cases (8 new tests):
- getDlxPackageDir: scoped packages, special chars, empty names
- getDlxPackageNodeModulesDir: scoped packages, empty names
- getDlxPackageJsonPath: scoped packages, empty names
- isInSocketDlx: exact directory path, nested paths, similar paths, special chars
Package detection edge cases (3 new tests):
- isDlxPackageInstalled: scoped packages, empty names
- listDlxPackages: special chars, scoped packages, filtering non-directories
- listDlxPackagesAsync: sorted list with 3 packages
Test count: 48 → 66 tests (+18 tests, +37.5%)
All tests passing - validates robust edge case handling across DLX utilities.
test(ansi): add 13 edge case tests for ANSI escape code handling
Add comprehensive edge case testing for ansiRegex and stripAnsi functions:
ansiRegex edge cases (6 new tests):
- Multiple different sequence types (CSI + OSC mixed)
- Text with no ANSI codes (null match)
- C1 control sequences (0x9B CSI)
- RGB color codes with colon separators
- onlyFirst option behavior with non-global regex
- Complex pattern matching across sequence types
stripAnsi edge cases (7 new tests):
- RGB color codes (38;2;R;G;B format)
- 256 color codes (38;5;N format)
- Strings containing only ANSI codes
- Mixed content with newlines
- Unicode text with ANSI codes (你好)
- Emoji with ANSI codes (🎉)
- Long text performance (1000 char strings)
Test count: 16 → 29 tests (+13 tests, +81.25%)
All tests passing - validates robust ANSI escape code handling.
test(packages): add 20 tests for normalize module (+100% coverage)
Add comprehensive tests for package.json normalization and Socket registry
name conversion utilities.
Tests added:
- normalizePackageJson: 6 tests
- Basic normalization with default version
- Preserve existing version
- Custom field preservation
- Dependencies handling
- Empty package.json
- resolveEscapedScope: 5 tests
- Socket registry name scope extraction (angular__cli)
- Unscoped packages (express)
- Empty strings
- Scope-only packages
- Multiple delimiter handling
- resolveOriginalPackageName: 5 tests
- Socket registry to original name conversion
- Unscoped package pass-through
- Socket registry scope prefix stripping (@socketregistry/)
- Remaining underscores preservation
- Simple scoped packages (@types/node)
- unescapeScope: 4 tests
- Scope delimiter conversion (angular__ → @angular)
- Single and multiple scopes
- Short scope names
Coverage impact:
- normalize.ts: 0 → 20 tests (100 LOC previously untested)
- Test suite: 6264 → 6284 tests
- Cumulative coverage: 83.78% → 83.84% (+0.06%)1 parent 9913348 commit 54bb9b0
File tree
4 files changed
+452
-0
lines changed- test
- integration
- unit
- dlx
- packages
4 files changed
+452
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
84 | 127 | | |
85 | 128 | | |
86 | 129 | | |
| |||
124 | 167 | | |
125 | 168 | | |
126 | 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 | + | |
127 | 218 | | |
128 | 219 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
101 | 138 | | |
102 | 139 | | |
103 | 140 | | |
| |||
175 | 212 | | |
176 | 213 | | |
177 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
178 | 234 | | |
179 | 235 | | |
180 | 236 | | |
| |||
184 | 240 | | |
185 | 241 | | |
186 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
187 | 256 | | |
188 | 257 | | |
189 | 258 | | |
| |||
209 | 278 | | |
210 | 279 | | |
211 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
212 | 294 | | |
213 | 295 | | |
214 | 296 | | |
| |||
240 | 322 | | |
241 | 323 | | |
242 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
243 | 358 | | |
244 | 359 | | |
245 | 360 | | |
| |||
264 | 379 | | |
265 | 380 | | |
266 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
267 | 394 | | |
268 | 395 | | |
269 | 396 | | |
| |||
298 | 425 | | |
299 | 426 | | |
300 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
301 | 466 | | |
302 | 467 | | |
303 | 468 | | |
| |||
316 | 481 | | |
317 | 482 | | |
318 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
319 | 497 | | |
320 | 498 | | |
321 | 499 | | |
| |||
0 commit comments