escape-no-icu.js
This file
Path
test/arguments/escape-no-icu.js
17 lines · 585 bytes · JavaScript
Last changed by
Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
History of this fileTake it
Fix Node.js without ICU support (#1144)ehmickybefore adoption074ea4a
lines 1–2why, one step back1// Mimics Node.js when built without ICU support2// See https://github.com/sindresorhus/execa/issues/1143Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
line 3why, one step back3// eslint-disable-next-line unicorn/no-global-object-property-assignment -- intentionally mocking the global `RegExp`Fix Node.js without ICU support (#1144)ehmickybefore adoption074ea4a
line 4why, one step back4globalThis.RegExp = class extends RegExp {Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
lines 5–6why, one step back5 static isMocked = true;6Fix Node.js without ICU support (#1144)ehmickybefore adoption074ea4a
lines 7–17why, one step back7 constructor(regExpString, flags) {8 if (flags?.includes('u') && regExpString.includes('\\p{')) {9 throw new Error('Invalid property name');10 }1112 super(regExpString, flags);13 }14};1516// Execa computes the RegExp when first loaded, so we must delay this import17await import('./escape.js');