Skip to content
Myr

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 file

Take it

Fix Node.js without ICU support (#1144)ehmickybefore adoption074ea4a

lines 1–2why, one step back
1// Mimics Node.js when built without ICU support
2// See https://github.com/sindresorhus/execa/issues/1143

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

line 3why, one step back
3// 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 back
4globalThis.RegExp = class extends RegExp {

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 5–6why, one step back
5 static isMocked = true;
6

Fix Node.js without ICU support (#1144)ehmickybefore adoption074ea4a

lines 7–17why, one step back
7 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');