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
123456789101112131415161718// Mimics Node.js when built without ICU support// See https://github.com/sindresorhus/execa/issues/1143// eslint-disable-next-line unicorn/no-global-object-property-assignment -- intentionally mocking the global `RegExp`globalThis.RegExp = class extends RegExp { static isMocked = true;
constructor(regExpString, flags) { if (flags?.includes('u') && regExpString.includes('\\p{')) { throw new Error('Invalid property name'); }
super(regExpString, flags); }};
// Execa computes the RegExp when first loaded, so we must delay this importawait import('./escape.js');