mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* fix: improve duplicate named groups check * Update packages/babel-helper-create-regexp-features-plugin/src/util.ts Co-authored-by: Nicolò Ribaudo <[email protected]> * Update packages/babel-helper-create-regexp-features-plugin/test/util.skip-bundled.js --------- Co-authored-by: Nicolò Ribaudo <[email protected]>
15 lines
521 B
JavaScript
15 lines
521 B
JavaScript
import { generateRegexpuOptions } from "../lib/util.js";
|
|
|
|
describe("generateRegexpuOptions", () => {
|
|
describe("should handle maliciously crafted pattern", () => {
|
|
it("\\(?<\\(?<...", () => {
|
|
const pattern = "" + new RegExp("\\(?<".repeat(4e4));
|
|
const startTime = Date.now();
|
|
const options = generateRegexpuOptions(pattern, 0);
|
|
const timeTaken = Date.now() - startTime;
|
|
expect(timeTaken).toBeLessThan(2000);
|
|
expect(options).toHaveProperty("namedGroups", false);
|
|
});
|
|
});
|
|
});
|