From 3554310ebfdc8b582c83aaaa58c5005d76354994 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Sat, 20 Mar 2021 19:19:24 -0400 Subject: [PATCH] Escape version strings passed to regular expression matchers Version strings in `process.versions` should be escaped before being used to construct regular expressions. Fixes tests when run against current Node.js master branch where OpenSSL has a `+` character in its version string. --- test/common.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/common.js b/test/common.js index e04c20a..0c662be 100644 --- a/test/common.js +++ b/test/common.js @@ -22,6 +22,10 @@ const REPORT_SECTIONS = [ const reNewline = '(?:\\r*\\n)'; +const escapeRegex = (s) => { + return s.replace(/[\.+]/g, '\\$&'); +} + exports.findReports = (pid) => { // Default filenames are of the form node-report..