@jsenv/test 3.6.12 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exception.js +955 -0
- package/dist/execute_using_dynamic_import.js +1 -1
- package/dist/js/node_child_process_controlled.mjs +5 -1
- package/dist/js/node_worker_thread_controlled.mjs +5 -1
- package/dist/jsenv_test.js +1613 -678
- package/dist/jsenv_test_node_modules.js +588 -1
- package/package.json +22 -17
- package/src/runtime_node/child_exec_options.js +1 -2
|
@@ -211,6 +211,420 @@ function isUnicodeSupported() {
|
|
|
211
211
|
|| env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
function ansiRegex({onlyFirst = false} = {}) {
|
|
215
|
+
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
|
216
|
+
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
|
|
217
|
+
const pattern = [
|
|
218
|
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
219
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
|
220
|
+
].join('|');
|
|
221
|
+
|
|
222
|
+
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const regex = ansiRegex();
|
|
226
|
+
|
|
227
|
+
function stripAnsi(string) {
|
|
228
|
+
if (typeof string !== 'string') {
|
|
229
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
233
|
+
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
234
|
+
// and doing it manually has a performance penalty.
|
|
235
|
+
return string.replace(regex, '');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const r = String.raw;
|
|
239
|
+
const seq = r`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`;
|
|
240
|
+
const sTags = r`\u{E0061}-\u{E007A}`;
|
|
241
|
+
const emojiRegex = () => new RegExp(r`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${sTags}]{2}[\u{E0030}-\u{E0039}${sTags}]{1,3}\u{E007F}|${seq}(?:\u200D${seq})*`, 'gu');
|
|
242
|
+
|
|
243
|
+
// Generated code.
|
|
244
|
+
|
|
245
|
+
function isAmbiguous(x) {
|
|
246
|
+
return x === 0xA1
|
|
247
|
+
|| x === 0xA4
|
|
248
|
+
|| x === 0xA7
|
|
249
|
+
|| x === 0xA8
|
|
250
|
+
|| x === 0xAA
|
|
251
|
+
|| x === 0xAD
|
|
252
|
+
|| x === 0xAE
|
|
253
|
+
|| x >= 0xB0 && x <= 0xB4
|
|
254
|
+
|| x >= 0xB6 && x <= 0xBA
|
|
255
|
+
|| x >= 0xBC && x <= 0xBF
|
|
256
|
+
|| x === 0xC6
|
|
257
|
+
|| x === 0xD0
|
|
258
|
+
|| x === 0xD7
|
|
259
|
+
|| x === 0xD8
|
|
260
|
+
|| x >= 0xDE && x <= 0xE1
|
|
261
|
+
|| x === 0xE6
|
|
262
|
+
|| x >= 0xE8 && x <= 0xEA
|
|
263
|
+
|| x === 0xEC
|
|
264
|
+
|| x === 0xED
|
|
265
|
+
|| x === 0xF0
|
|
266
|
+
|| x === 0xF2
|
|
267
|
+
|| x === 0xF3
|
|
268
|
+
|| x >= 0xF7 && x <= 0xFA
|
|
269
|
+
|| x === 0xFC
|
|
270
|
+
|| x === 0xFE
|
|
271
|
+
|| x === 0x101
|
|
272
|
+
|| x === 0x111
|
|
273
|
+
|| x === 0x113
|
|
274
|
+
|| x === 0x11B
|
|
275
|
+
|| x === 0x126
|
|
276
|
+
|| x === 0x127
|
|
277
|
+
|| x === 0x12B
|
|
278
|
+
|| x >= 0x131 && x <= 0x133
|
|
279
|
+
|| x === 0x138
|
|
280
|
+
|| x >= 0x13F && x <= 0x142
|
|
281
|
+
|| x === 0x144
|
|
282
|
+
|| x >= 0x148 && x <= 0x14B
|
|
283
|
+
|| x === 0x14D
|
|
284
|
+
|| x === 0x152
|
|
285
|
+
|| x === 0x153
|
|
286
|
+
|| x === 0x166
|
|
287
|
+
|| x === 0x167
|
|
288
|
+
|| x === 0x16B
|
|
289
|
+
|| x === 0x1CE
|
|
290
|
+
|| x === 0x1D0
|
|
291
|
+
|| x === 0x1D2
|
|
292
|
+
|| x === 0x1D4
|
|
293
|
+
|| x === 0x1D6
|
|
294
|
+
|| x === 0x1D8
|
|
295
|
+
|| x === 0x1DA
|
|
296
|
+
|| x === 0x1DC
|
|
297
|
+
|| x === 0x251
|
|
298
|
+
|| x === 0x261
|
|
299
|
+
|| x === 0x2C4
|
|
300
|
+
|| x === 0x2C7
|
|
301
|
+
|| x >= 0x2C9 && x <= 0x2CB
|
|
302
|
+
|| x === 0x2CD
|
|
303
|
+
|| x === 0x2D0
|
|
304
|
+
|| x >= 0x2D8 && x <= 0x2DB
|
|
305
|
+
|| x === 0x2DD
|
|
306
|
+
|| x === 0x2DF
|
|
307
|
+
|| x >= 0x300 && x <= 0x36F
|
|
308
|
+
|| x >= 0x391 && x <= 0x3A1
|
|
309
|
+
|| x >= 0x3A3 && x <= 0x3A9
|
|
310
|
+
|| x >= 0x3B1 && x <= 0x3C1
|
|
311
|
+
|| x >= 0x3C3 && x <= 0x3C9
|
|
312
|
+
|| x === 0x401
|
|
313
|
+
|| x >= 0x410 && x <= 0x44F
|
|
314
|
+
|| x === 0x451
|
|
315
|
+
|| x === 0x2010
|
|
316
|
+
|| x >= 0x2013 && x <= 0x2016
|
|
317
|
+
|| x === 0x2018
|
|
318
|
+
|| x === 0x2019
|
|
319
|
+
|| x === 0x201C
|
|
320
|
+
|| x === 0x201D
|
|
321
|
+
|| x >= 0x2020 && x <= 0x2022
|
|
322
|
+
|| x >= 0x2024 && x <= 0x2027
|
|
323
|
+
|| x === 0x2030
|
|
324
|
+
|| x === 0x2032
|
|
325
|
+
|| x === 0x2033
|
|
326
|
+
|| x === 0x2035
|
|
327
|
+
|| x === 0x203B
|
|
328
|
+
|| x === 0x203E
|
|
329
|
+
|| x === 0x2074
|
|
330
|
+
|| x === 0x207F
|
|
331
|
+
|| x >= 0x2081 && x <= 0x2084
|
|
332
|
+
|| x === 0x20AC
|
|
333
|
+
|| x === 0x2103
|
|
334
|
+
|| x === 0x2105
|
|
335
|
+
|| x === 0x2109
|
|
336
|
+
|| x === 0x2113
|
|
337
|
+
|| x === 0x2116
|
|
338
|
+
|| x === 0x2121
|
|
339
|
+
|| x === 0x2122
|
|
340
|
+
|| x === 0x2126
|
|
341
|
+
|| x === 0x212B
|
|
342
|
+
|| x === 0x2153
|
|
343
|
+
|| x === 0x2154
|
|
344
|
+
|| x >= 0x215B && x <= 0x215E
|
|
345
|
+
|| x >= 0x2160 && x <= 0x216B
|
|
346
|
+
|| x >= 0x2170 && x <= 0x2179
|
|
347
|
+
|| x === 0x2189
|
|
348
|
+
|| x >= 0x2190 && x <= 0x2199
|
|
349
|
+
|| x === 0x21B8
|
|
350
|
+
|| x === 0x21B9
|
|
351
|
+
|| x === 0x21D2
|
|
352
|
+
|| x === 0x21D4
|
|
353
|
+
|| x === 0x21E7
|
|
354
|
+
|| x === 0x2200
|
|
355
|
+
|| x === 0x2202
|
|
356
|
+
|| x === 0x2203
|
|
357
|
+
|| x === 0x2207
|
|
358
|
+
|| x === 0x2208
|
|
359
|
+
|| x === 0x220B
|
|
360
|
+
|| x === 0x220F
|
|
361
|
+
|| x === 0x2211
|
|
362
|
+
|| x === 0x2215
|
|
363
|
+
|| x === 0x221A
|
|
364
|
+
|| x >= 0x221D && x <= 0x2220
|
|
365
|
+
|| x === 0x2223
|
|
366
|
+
|| x === 0x2225
|
|
367
|
+
|| x >= 0x2227 && x <= 0x222C
|
|
368
|
+
|| x === 0x222E
|
|
369
|
+
|| x >= 0x2234 && x <= 0x2237
|
|
370
|
+
|| x === 0x223C
|
|
371
|
+
|| x === 0x223D
|
|
372
|
+
|| x === 0x2248
|
|
373
|
+
|| x === 0x224C
|
|
374
|
+
|| x === 0x2252
|
|
375
|
+
|| x === 0x2260
|
|
376
|
+
|| x === 0x2261
|
|
377
|
+
|| x >= 0x2264 && x <= 0x2267
|
|
378
|
+
|| x === 0x226A
|
|
379
|
+
|| x === 0x226B
|
|
380
|
+
|| x === 0x226E
|
|
381
|
+
|| x === 0x226F
|
|
382
|
+
|| x === 0x2282
|
|
383
|
+
|| x === 0x2283
|
|
384
|
+
|| x === 0x2286
|
|
385
|
+
|| x === 0x2287
|
|
386
|
+
|| x === 0x2295
|
|
387
|
+
|| x === 0x2299
|
|
388
|
+
|| x === 0x22A5
|
|
389
|
+
|| x === 0x22BF
|
|
390
|
+
|| x === 0x2312
|
|
391
|
+
|| x >= 0x2460 && x <= 0x24E9
|
|
392
|
+
|| x >= 0x24EB && x <= 0x254B
|
|
393
|
+
|| x >= 0x2550 && x <= 0x2573
|
|
394
|
+
|| x >= 0x2580 && x <= 0x258F
|
|
395
|
+
|| x >= 0x2592 && x <= 0x2595
|
|
396
|
+
|| x === 0x25A0
|
|
397
|
+
|| x === 0x25A1
|
|
398
|
+
|| x >= 0x25A3 && x <= 0x25A9
|
|
399
|
+
|| x === 0x25B2
|
|
400
|
+
|| x === 0x25B3
|
|
401
|
+
|| x === 0x25B6
|
|
402
|
+
|| x === 0x25B7
|
|
403
|
+
|| x === 0x25BC
|
|
404
|
+
|| x === 0x25BD
|
|
405
|
+
|| x === 0x25C0
|
|
406
|
+
|| x === 0x25C1
|
|
407
|
+
|| x >= 0x25C6 && x <= 0x25C8
|
|
408
|
+
|| x === 0x25CB
|
|
409
|
+
|| x >= 0x25CE && x <= 0x25D1
|
|
410
|
+
|| x >= 0x25E2 && x <= 0x25E5
|
|
411
|
+
|| x === 0x25EF
|
|
412
|
+
|| x === 0x2605
|
|
413
|
+
|| x === 0x2606
|
|
414
|
+
|| x === 0x2609
|
|
415
|
+
|| x === 0x260E
|
|
416
|
+
|| x === 0x260F
|
|
417
|
+
|| x === 0x261C
|
|
418
|
+
|| x === 0x261E
|
|
419
|
+
|| x === 0x2640
|
|
420
|
+
|| x === 0x2642
|
|
421
|
+
|| x === 0x2660
|
|
422
|
+
|| x === 0x2661
|
|
423
|
+
|| x >= 0x2663 && x <= 0x2665
|
|
424
|
+
|| x >= 0x2667 && x <= 0x266A
|
|
425
|
+
|| x === 0x266C
|
|
426
|
+
|| x === 0x266D
|
|
427
|
+
|| x === 0x266F
|
|
428
|
+
|| x === 0x269E
|
|
429
|
+
|| x === 0x269F
|
|
430
|
+
|| x === 0x26BF
|
|
431
|
+
|| x >= 0x26C6 && x <= 0x26CD
|
|
432
|
+
|| x >= 0x26CF && x <= 0x26D3
|
|
433
|
+
|| x >= 0x26D5 && x <= 0x26E1
|
|
434
|
+
|| x === 0x26E3
|
|
435
|
+
|| x === 0x26E8
|
|
436
|
+
|| x === 0x26E9
|
|
437
|
+
|| x >= 0x26EB && x <= 0x26F1
|
|
438
|
+
|| x === 0x26F4
|
|
439
|
+
|| x >= 0x26F6 && x <= 0x26F9
|
|
440
|
+
|| x === 0x26FB
|
|
441
|
+
|| x === 0x26FC
|
|
442
|
+
|| x === 0x26FE
|
|
443
|
+
|| x === 0x26FF
|
|
444
|
+
|| x === 0x273D
|
|
445
|
+
|| x >= 0x2776 && x <= 0x277F
|
|
446
|
+
|| x >= 0x2B56 && x <= 0x2B59
|
|
447
|
+
|| x >= 0x3248 && x <= 0x324F
|
|
448
|
+
|| x >= 0xE000 && x <= 0xF8FF
|
|
449
|
+
|| x >= 0xFE00 && x <= 0xFE0F
|
|
450
|
+
|| x === 0xFFFD
|
|
451
|
+
|| x >= 0x1F100 && x <= 0x1F10A
|
|
452
|
+
|| x >= 0x1F110 && x <= 0x1F12D
|
|
453
|
+
|| x >= 0x1F130 && x <= 0x1F169
|
|
454
|
+
|| x >= 0x1F170 && x <= 0x1F18D
|
|
455
|
+
|| x === 0x1F18F
|
|
456
|
+
|| x === 0x1F190
|
|
457
|
+
|| x >= 0x1F19B && x <= 0x1F1AC
|
|
458
|
+
|| x >= 0xE0100 && x <= 0xE01EF
|
|
459
|
+
|| x >= 0xF0000 && x <= 0xFFFFD
|
|
460
|
+
|| x >= 0x100000 && x <= 0x10FFFD;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function isFullWidth(x) {
|
|
464
|
+
return x === 0x3000
|
|
465
|
+
|| x >= 0xFF01 && x <= 0xFF60
|
|
466
|
+
|| x >= 0xFFE0 && x <= 0xFFE6;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function isWide(x) {
|
|
470
|
+
return x >= 0x1100 && x <= 0x115F
|
|
471
|
+
|| x === 0x231A
|
|
472
|
+
|| x === 0x231B
|
|
473
|
+
|| x === 0x2329
|
|
474
|
+
|| x === 0x232A
|
|
475
|
+
|| x >= 0x23E9 && x <= 0x23EC
|
|
476
|
+
|| x === 0x23F0
|
|
477
|
+
|| x === 0x23F3
|
|
478
|
+
|| x === 0x25FD
|
|
479
|
+
|| x === 0x25FE
|
|
480
|
+
|| x === 0x2614
|
|
481
|
+
|| x === 0x2615
|
|
482
|
+
|| x >= 0x2630 && x <= 0x2637
|
|
483
|
+
|| x >= 0x2648 && x <= 0x2653
|
|
484
|
+
|| x === 0x267F
|
|
485
|
+
|| x >= 0x268A && x <= 0x268F
|
|
486
|
+
|| x === 0x2693
|
|
487
|
+
|| x === 0x26A1
|
|
488
|
+
|| x === 0x26AA
|
|
489
|
+
|| x === 0x26AB
|
|
490
|
+
|| x === 0x26BD
|
|
491
|
+
|| x === 0x26BE
|
|
492
|
+
|| x === 0x26C4
|
|
493
|
+
|| x === 0x26C5
|
|
494
|
+
|| x === 0x26CE
|
|
495
|
+
|| x === 0x26D4
|
|
496
|
+
|| x === 0x26EA
|
|
497
|
+
|| x === 0x26F2
|
|
498
|
+
|| x === 0x26F3
|
|
499
|
+
|| x === 0x26F5
|
|
500
|
+
|| x === 0x26FA
|
|
501
|
+
|| x === 0x26FD
|
|
502
|
+
|| x === 0x2705
|
|
503
|
+
|| x === 0x270A
|
|
504
|
+
|| x === 0x270B
|
|
505
|
+
|| x === 0x2728
|
|
506
|
+
|| x === 0x274C
|
|
507
|
+
|| x === 0x274E
|
|
508
|
+
|| x >= 0x2753 && x <= 0x2755
|
|
509
|
+
|| x === 0x2757
|
|
510
|
+
|| x >= 0x2795 && x <= 0x2797
|
|
511
|
+
|| x === 0x27B0
|
|
512
|
+
|| x === 0x27BF
|
|
513
|
+
|| x === 0x2B1B
|
|
514
|
+
|| x === 0x2B1C
|
|
515
|
+
|| x === 0x2B50
|
|
516
|
+
|| x === 0x2B55
|
|
517
|
+
|| x >= 0x2E80 && x <= 0x2E99
|
|
518
|
+
|| x >= 0x2E9B && x <= 0x2EF3
|
|
519
|
+
|| x >= 0x2F00 && x <= 0x2FD5
|
|
520
|
+
|| x >= 0x2FF0 && x <= 0x2FFF
|
|
521
|
+
|| x >= 0x3001 && x <= 0x303E
|
|
522
|
+
|| x >= 0x3041 && x <= 0x3096
|
|
523
|
+
|| x >= 0x3099 && x <= 0x30FF
|
|
524
|
+
|| x >= 0x3105 && x <= 0x312F
|
|
525
|
+
|| x >= 0x3131 && x <= 0x318E
|
|
526
|
+
|| x >= 0x3190 && x <= 0x31E5
|
|
527
|
+
|| x >= 0x31EF && x <= 0x321E
|
|
528
|
+
|| x >= 0x3220 && x <= 0x3247
|
|
529
|
+
|| x >= 0x3250 && x <= 0xA48C
|
|
530
|
+
|| x >= 0xA490 && x <= 0xA4C6
|
|
531
|
+
|| x >= 0xA960 && x <= 0xA97C
|
|
532
|
+
|| x >= 0xAC00 && x <= 0xD7A3
|
|
533
|
+
|| x >= 0xF900 && x <= 0xFAFF
|
|
534
|
+
|| x >= 0xFE10 && x <= 0xFE19
|
|
535
|
+
|| x >= 0xFE30 && x <= 0xFE52
|
|
536
|
+
|| x >= 0xFE54 && x <= 0xFE66
|
|
537
|
+
|| x >= 0xFE68 && x <= 0xFE6B
|
|
538
|
+
|| x >= 0x16FE0 && x <= 0x16FE4
|
|
539
|
+
|| x === 0x16FF0
|
|
540
|
+
|| x === 0x16FF1
|
|
541
|
+
|| x >= 0x17000 && x <= 0x187F7
|
|
542
|
+
|| x >= 0x18800 && x <= 0x18CD5
|
|
543
|
+
|| x >= 0x18CFF && x <= 0x18D08
|
|
544
|
+
|| x >= 0x1AFF0 && x <= 0x1AFF3
|
|
545
|
+
|| x >= 0x1AFF5 && x <= 0x1AFFB
|
|
546
|
+
|| x === 0x1AFFD
|
|
547
|
+
|| x === 0x1AFFE
|
|
548
|
+
|| x >= 0x1B000 && x <= 0x1B122
|
|
549
|
+
|| x === 0x1B132
|
|
550
|
+
|| x >= 0x1B150 && x <= 0x1B152
|
|
551
|
+
|| x === 0x1B155
|
|
552
|
+
|| x >= 0x1B164 && x <= 0x1B167
|
|
553
|
+
|| x >= 0x1B170 && x <= 0x1B2FB
|
|
554
|
+
|| x >= 0x1D300 && x <= 0x1D356
|
|
555
|
+
|| x >= 0x1D360 && x <= 0x1D376
|
|
556
|
+
|| x === 0x1F004
|
|
557
|
+
|| x === 0x1F0CF
|
|
558
|
+
|| x === 0x1F18E
|
|
559
|
+
|| x >= 0x1F191 && x <= 0x1F19A
|
|
560
|
+
|| x >= 0x1F200 && x <= 0x1F202
|
|
561
|
+
|| x >= 0x1F210 && x <= 0x1F23B
|
|
562
|
+
|| x >= 0x1F240 && x <= 0x1F248
|
|
563
|
+
|| x === 0x1F250
|
|
564
|
+
|| x === 0x1F251
|
|
565
|
+
|| x >= 0x1F260 && x <= 0x1F265
|
|
566
|
+
|| x >= 0x1F300 && x <= 0x1F320
|
|
567
|
+
|| x >= 0x1F32D && x <= 0x1F335
|
|
568
|
+
|| x >= 0x1F337 && x <= 0x1F37C
|
|
569
|
+
|| x >= 0x1F37E && x <= 0x1F393
|
|
570
|
+
|| x >= 0x1F3A0 && x <= 0x1F3CA
|
|
571
|
+
|| x >= 0x1F3CF && x <= 0x1F3D3
|
|
572
|
+
|| x >= 0x1F3E0 && x <= 0x1F3F0
|
|
573
|
+
|| x === 0x1F3F4
|
|
574
|
+
|| x >= 0x1F3F8 && x <= 0x1F43E
|
|
575
|
+
|| x === 0x1F440
|
|
576
|
+
|| x >= 0x1F442 && x <= 0x1F4FC
|
|
577
|
+
|| x >= 0x1F4FF && x <= 0x1F53D
|
|
578
|
+
|| x >= 0x1F54B && x <= 0x1F54E
|
|
579
|
+
|| x >= 0x1F550 && x <= 0x1F567
|
|
580
|
+
|| x === 0x1F57A
|
|
581
|
+
|| x === 0x1F595
|
|
582
|
+
|| x === 0x1F596
|
|
583
|
+
|| x === 0x1F5A4
|
|
584
|
+
|| x >= 0x1F5FB && x <= 0x1F64F
|
|
585
|
+
|| x >= 0x1F680 && x <= 0x1F6C5
|
|
586
|
+
|| x === 0x1F6CC
|
|
587
|
+
|| x >= 0x1F6D0 && x <= 0x1F6D2
|
|
588
|
+
|| x >= 0x1F6D5 && x <= 0x1F6D7
|
|
589
|
+
|| x >= 0x1F6DC && x <= 0x1F6DF
|
|
590
|
+
|| x === 0x1F6EB
|
|
591
|
+
|| x === 0x1F6EC
|
|
592
|
+
|| x >= 0x1F6F4 && x <= 0x1F6FC
|
|
593
|
+
|| x >= 0x1F7E0 && x <= 0x1F7EB
|
|
594
|
+
|| x === 0x1F7F0
|
|
595
|
+
|| x >= 0x1F90C && x <= 0x1F93A
|
|
596
|
+
|| x >= 0x1F93C && x <= 0x1F945
|
|
597
|
+
|| x >= 0x1F947 && x <= 0x1F9FF
|
|
598
|
+
|| x >= 0x1FA70 && x <= 0x1FA7C
|
|
599
|
+
|| x >= 0x1FA80 && x <= 0x1FA89
|
|
600
|
+
|| x >= 0x1FA8F && x <= 0x1FAC6
|
|
601
|
+
|| x >= 0x1FACE && x <= 0x1FADC
|
|
602
|
+
|| x >= 0x1FADF && x <= 0x1FAE9
|
|
603
|
+
|| x >= 0x1FAF0 && x <= 0x1FAF8
|
|
604
|
+
|| x >= 0x20000 && x <= 0x2FFFD
|
|
605
|
+
|| x >= 0x30000 && x <= 0x3FFFD;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function validate(codePoint) {
|
|
609
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
610
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
615
|
+
validate(codePoint);
|
|
616
|
+
|
|
617
|
+
if (
|
|
618
|
+
isFullWidth(codePoint)
|
|
619
|
+
|| isWide(codePoint)
|
|
620
|
+
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
|
621
|
+
) {
|
|
622
|
+
return 2;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
return 1;
|
|
626
|
+
}
|
|
627
|
+
|
|
214
628
|
/* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */
|
|
215
629
|
|
|
216
630
|
const isBrowser = globalThis.window?.document !== undefined;
|
|
@@ -292,4 +706,177 @@ const clearTerminal = isWindows
|
|
|
292
706
|
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
293
707
|
: `${eraseScreen}${ESC}3J${ESC}H`;
|
|
294
708
|
|
|
295
|
-
|
|
709
|
+
function createRawFrame(raw) {
|
|
710
|
+
return {
|
|
711
|
+
column: -1,
|
|
712
|
+
fileName: "",
|
|
713
|
+
line: -1,
|
|
714
|
+
name: "",
|
|
715
|
+
raw: raw,
|
|
716
|
+
sourceColumn: -1,
|
|
717
|
+
sourceFileName: "",
|
|
718
|
+
sourceLine: -1,
|
|
719
|
+
type: "",
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
var FIREFOX_WEBKIT = /([^@]+|^)@(.*):(\d+):(\d+)/;
|
|
723
|
+
var WEBKIT_ADDRESS_UNNAMED = /^(http(s)?:\/\/.*):(\d+):(\d+)$/;
|
|
724
|
+
var WEBKIT_NATIVE_UNNAMED = "[native code]";
|
|
725
|
+
function parsWebkit(str) {
|
|
726
|
+
if (str.includes(WEBKIT_NATIVE_UNNAMED)) {
|
|
727
|
+
return {
|
|
728
|
+
line: -1,
|
|
729
|
+
column: -1,
|
|
730
|
+
type: "native",
|
|
731
|
+
fileName: "",
|
|
732
|
+
name: "",
|
|
733
|
+
raw: str,
|
|
734
|
+
sourceColumn: -1,
|
|
735
|
+
sourceFileName: "",
|
|
736
|
+
sourceLine: -1,
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
var match = str.match(WEBKIT_ADDRESS_UNNAMED);
|
|
740
|
+
if (match) {
|
|
741
|
+
var line = match[3] ? +match[3] : -1;
|
|
742
|
+
var column = match[4] ? +match[4] : -1;
|
|
743
|
+
var fileName = match[1] ? match[1] : "";
|
|
744
|
+
return {
|
|
745
|
+
line: line,
|
|
746
|
+
column: column,
|
|
747
|
+
type: "",
|
|
748
|
+
fileName: fileName,
|
|
749
|
+
name: "",
|
|
750
|
+
raw: str,
|
|
751
|
+
sourceColumn: -1,
|
|
752
|
+
sourceFileName: "",
|
|
753
|
+
sourceLine: -1,
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
return createRawFrame(str);
|
|
757
|
+
}
|
|
758
|
+
function parseFirefoxWebkit(lines) {
|
|
759
|
+
return lines.map(function (str) {
|
|
760
|
+
var match = str.match(FIREFOX_WEBKIT);
|
|
761
|
+
if (!match) {
|
|
762
|
+
return parsWebkit(str);
|
|
763
|
+
}
|
|
764
|
+
var line = match[3] ? +match[3] : -1;
|
|
765
|
+
var column = match[4] ? +match[4] : -1;
|
|
766
|
+
var fileName = match[2] ? match[2] : "";
|
|
767
|
+
return {
|
|
768
|
+
line: line,
|
|
769
|
+
column: column,
|
|
770
|
+
type: match[0] ? "" : "native",
|
|
771
|
+
fileName: fileName,
|
|
772
|
+
name: (match[1] || "").trim(),
|
|
773
|
+
raw: str,
|
|
774
|
+
sourceColumn: -1,
|
|
775
|
+
sourceFileName: "",
|
|
776
|
+
sourceLine: -1,
|
|
777
|
+
};
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
// foo.bar.js:123:39
|
|
781
|
+
// foo.bar.js:123:39 <- original.js:123:34
|
|
782
|
+
var CHROME_MAPPED = /(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/;
|
|
783
|
+
function parseMapped(frame, maybeMapped) {
|
|
784
|
+
var match = maybeMapped.match(CHROME_MAPPED);
|
|
785
|
+
if (match) {
|
|
786
|
+
frame.fileName = match[1];
|
|
787
|
+
frame.line = +match[2];
|
|
788
|
+
frame.column = +match[3];
|
|
789
|
+
if (match[5])
|
|
790
|
+
frame.sourceFileName = match[5];
|
|
791
|
+
if (match[6])
|
|
792
|
+
frame.sourceLine = +match[6];
|
|
793
|
+
if (match[7])
|
|
794
|
+
frame.sourceColumn = +match[7];
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
// at <SomeFramework>
|
|
798
|
+
var CHROME_IE_NATIVE_NO_LINE = /^at\s(<.*>)$/;
|
|
799
|
+
// at <SomeFramework>:123:39
|
|
800
|
+
var CHROME_IE_NATIVE = /^\s*at\s(<.*>):(\d+):(\d+)$/;
|
|
801
|
+
// at foo.bar(bob) (foo.bar.js:123:39)
|
|
802
|
+
// at foo.bar(bob) (foo.bar.js:123:39 <- original.js:123:34)
|
|
803
|
+
var CHROME_IE_FUNCTION = /^at\s(.*)\s\((.*)\)$/;
|
|
804
|
+
// >= Chrome 88
|
|
805
|
+
// spy() at Component.Foo [as constructor] (original.js:123:34)
|
|
806
|
+
// spy() at Component.Foo [as constructor] (foo.bar.js:123:39 <- original.js:123:34)
|
|
807
|
+
var CHROME_IE_FUNCTION_WITH_CALL = /^([\w\W]*)\s\((.*)\)/;
|
|
808
|
+
var CHROME_IE_DETECTOR = /\s*at\s.+/;
|
|
809
|
+
// at about:blank:1:7
|
|
810
|
+
// >= Chrome 99
|
|
811
|
+
// at /projects/foo.test.js:689:1 <- /projects/foo.test.js:10:1
|
|
812
|
+
var CHROME_BLANK = /\s*at\s(.*):(\d+):(\d+)$/;
|
|
813
|
+
function parseChromeIe(lines) {
|
|
814
|
+
// Many frameworks mess with error.stack. So we use this check
|
|
815
|
+
// to find the first line of the actual stack
|
|
816
|
+
var start = lines.findIndex(function (line) { return CHROME_IE_DETECTOR.test(line); });
|
|
817
|
+
if (start === -1) {
|
|
818
|
+
return [];
|
|
819
|
+
}
|
|
820
|
+
var frames = [];
|
|
821
|
+
for (var i = start; i < lines.length; i++) {
|
|
822
|
+
var str = lines[i].replace(/^\s+|\s+$/g, "");
|
|
823
|
+
var frame = createRawFrame(lines[i]);
|
|
824
|
+
var nativeNoLine = str.match(CHROME_IE_NATIVE_NO_LINE);
|
|
825
|
+
if (nativeNoLine) {
|
|
826
|
+
frame.fileName = nativeNoLine[1];
|
|
827
|
+
frame.type = "native";
|
|
828
|
+
frames.push(frame);
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
var native = str.match(CHROME_IE_NATIVE);
|
|
832
|
+
if (native) {
|
|
833
|
+
frame.fileName = native[1];
|
|
834
|
+
frame.type = "native";
|
|
835
|
+
if (native[2])
|
|
836
|
+
frame.line = +native[2];
|
|
837
|
+
if (native[3])
|
|
838
|
+
frame.column = +native[3];
|
|
839
|
+
frames.push(frame);
|
|
840
|
+
continue;
|
|
841
|
+
}
|
|
842
|
+
var withFn = str.match(CHROME_IE_FUNCTION);
|
|
843
|
+
if (withFn) {
|
|
844
|
+
frame.name = withFn[1];
|
|
845
|
+
parseMapped(frame, withFn[2]);
|
|
846
|
+
frames.push(frame);
|
|
847
|
+
continue;
|
|
848
|
+
}
|
|
849
|
+
var blank = str.match(CHROME_BLANK);
|
|
850
|
+
if (blank) {
|
|
851
|
+
frame.fileName = blank[1];
|
|
852
|
+
frame.line = +blank[2];
|
|
853
|
+
frame.column = +blank[3];
|
|
854
|
+
parseMapped(frame, blank[1] + ":" + blank[2] + ":" + blank[3]);
|
|
855
|
+
frames.push(frame);
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
var withFnCall = str.match(CHROME_IE_FUNCTION_WITH_CALL);
|
|
859
|
+
if (withFnCall) {
|
|
860
|
+
frame.name = withFnCall[1];
|
|
861
|
+
parseMapped(frame, withFnCall[2]);
|
|
862
|
+
frames.push(frame);
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
frames.push(frame);
|
|
866
|
+
}
|
|
867
|
+
return frames;
|
|
868
|
+
}
|
|
869
|
+
function parseStackTrace(stack) {
|
|
870
|
+
if (!stack)
|
|
871
|
+
return [];
|
|
872
|
+
var lines = stack.split("\n").filter(Boolean);
|
|
873
|
+
// Libraries like node's "assert" module mess with the stack trace by
|
|
874
|
+
// prepending custom data. So we need to do a precheck, to determine
|
|
875
|
+
// which browser the trace is coming from.
|
|
876
|
+
if (lines.some(function (line) { return CHROME_IE_DETECTOR.test(line); })) {
|
|
877
|
+
return parseChromeIe(lines);
|
|
878
|
+
}
|
|
879
|
+
return parseFirefoxWebkit(lines);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
export { clearTerminal, createSupportsColor, eastAsianWidth, emojiRegex, eraseLines, isUnicodeSupported, parseStackTrace, stripAnsi };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,37 +31,42 @@
|
|
|
31
31
|
"./src/runtime_node/node_child_process_controlled.mjs",
|
|
32
32
|
"./src/runtime_node/node_worker_thread_controlled.mjs",
|
|
33
33
|
"./dist/js/node_child_process_controlled.mjs",
|
|
34
|
-
"./dist/js/node_worker_thread_controlled.mjs"
|
|
34
|
+
"./dist/js/node_worker_thread_controlled.mjs",
|
|
35
|
+
"./dist/jsenv_test_node_modules.js",
|
|
36
|
+
"./dist/jsenv_test.js"
|
|
35
37
|
],
|
|
36
38
|
"scripts": {
|
|
37
39
|
"build": "node --conditions=development ./scripts/build.mjs",
|
|
38
40
|
"prepublishOnly": "npm run build"
|
|
39
41
|
},
|
|
40
42
|
"optionalDependencies": {
|
|
41
|
-
"playwright": "1.x"
|
|
43
|
+
"playwright": "1.x",
|
|
44
|
+
"playwright-core": "1.x"
|
|
42
45
|
},
|
|
43
46
|
"dependencies": {
|
|
44
47
|
"@c88/v8-coverage": "0.1.1",
|
|
45
|
-
"@jsenv/
|
|
46
|
-
"@jsenv/
|
|
47
|
-
"@jsenv/
|
|
48
|
-
"@jsenv/filesystem": "4.15.0",
|
|
49
|
-
"@jsenv/github-check-run": "0.2.23",
|
|
50
|
-
"@jsenv/node-esm-resolution": "1.2.0",
|
|
51
|
-
"@jsenv/humanize": "1.5.0",
|
|
52
|
-
"@jsenv/plugin-supervisor": "1.6.13",
|
|
53
|
-
"@jsenv/sourcemap": "1.3.5",
|
|
54
|
-
"@jsenv/url-meta": "8.5.6",
|
|
55
|
-
"@jsenv/urls": "2.7.2",
|
|
56
|
-
"@jsenv/utils": "2.3.0",
|
|
48
|
+
"@jsenv/ast": "6.6.10",
|
|
49
|
+
"@jsenv/plugin-supervisor": "1.6.14",
|
|
50
|
+
"@jsenv/sourcemap": "1.3.6",
|
|
57
51
|
"he": "1.2.0",
|
|
58
52
|
"istanbul-lib-coverage": "3.2.2",
|
|
59
53
|
"istanbul-lib-instrument": "6.0.3",
|
|
60
54
|
"istanbul-lib-report": "3.0.1",
|
|
61
55
|
"istanbul-reports": "3.1.7",
|
|
62
56
|
"pidtree": "0.6.0",
|
|
63
|
-
"strip-ansi": "7.1.0",
|
|
64
|
-
"supports-color": "10.0.0",
|
|
65
57
|
"v8-to-istanbul": "9.3.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@jsenv/abort": "4.3.1",
|
|
61
|
+
"@jsenv/exception": "1.1.8",
|
|
62
|
+
"@jsenv/filesystem": "4.15.1",
|
|
63
|
+
"@jsenv/github-check-run": "0.3.0",
|
|
64
|
+
"@jsenv/node-esm-resolution": "1.2.0",
|
|
65
|
+
"@jsenv/url-meta": "8.5.7",
|
|
66
|
+
"@jsenv/urls": "2.7.3",
|
|
67
|
+
"@jsenv/utils": "2.3.1",
|
|
68
|
+
"@jsenv/humanize": "1.5.1",
|
|
69
|
+
"strip-ansi": "7.1.0",
|
|
70
|
+
"supports-color": "10.0.0"
|
|
66
71
|
}
|
|
67
72
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { findFreePort } from "@jsenv/server";
|
|
2
|
-
|
|
3
1
|
import { createDetailedMessage } from "@jsenv/humanize";
|
|
2
|
+
import { findFreePort } from "@jsenv/server/src/internal/listen.js";
|
|
4
3
|
import { ExecOptions } from "./exec_options.js";
|
|
5
4
|
|
|
6
5
|
export const createChildExecOptions = async ({
|