test(profiling): replace RegExp.escape with includes check - #8058
Conversation
`RegExp.escape` is a very recent TC39 addition (stage-4 in 2024) and is not available on Node.js 18, which this repo still supports. The existing `assert.match(..., new RegExp(RegExp.escape(warning)))` would crash with a `TypeError: RegExp.escape is not a function` on the oldest supported runtime. Since the assertion only needed to confirm the joined warnings include a literal substring, swap it for `assert.ok(joined.includes(warning))` with a descriptive failure message. No pattern matching required, no polyfill added, and the test now works on every supported Node.js version.
Overall package sizeSelf size: 5.54 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.1 | 82.56 kB | 817.39 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8058 +/- ##
==========================================
+ Coverage 73.60% 73.66% +0.05%
==========================================
Files 773 776 +3
Lines 36088 36242 +154
==========================================
+ Hits 26562 26696 +134
- Misses 9526 9546 +20 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: a2794a5 | Docs | Datadog PR Page | Give us feedback! |
BenchmarksBenchmark execution time: 2026-04-22 13:22:02 Comparing candidate commit a2794a5 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1381 metrics, 103 unstable metrics. |
`RegExp.escape` is a very recent TC39 addition (stage-4 in 2024) and is not available on Node.js 18, which this repo still supports. The existing `assert.match(..., new RegExp(RegExp.escape(warning)))` would crash with a `TypeError: RegExp.escape is not a function` on the oldest supported runtime. Since the assertion only needed to confirm the joined warnings include a literal substring, swap it for `assert.ok(joined.includes(warning))` with a descriptive failure message. No pattern matching required, no polyfill added, and the test now works on every supported Node.js version.
RegExp.escapeis a very recent TC39 addition (stage-4 in 2024) and is not available on Node.js 18, which this repo still supports. The existingassert.match(..., new RegExp(RegExp.escape(warning)))would crash with aTypeError: RegExp.escape is not a functionon the oldest supported runtime.Since the assertion only needed to confirm the joined warnings include a literal substring, swap it for
assert.ok(joined.includes(warning))with a descriptive failure message. No pattern matching required, no polyfill added, and the test now works on every supported Node.js version.