镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.<date>.<time>.<pid>.<seq>.txt
const format = '^node-report\\.\\d+\\.\\d+\\.' + pid + '\\.\\d+\\.txt$';
Expand Down Expand Up @@ -114,11 +118,11 @@ exports.validateContent = function validateContent(data, t, options) {
if (c !== 'node') {
if (expectedVersions.indexOf(c) === -1) {
t.notMatch(nodeReportSection,
new RegExp(c + ': ' + process.versions[c]),
new RegExp(c + ': ' + escapeRegex(process.versions[c])),
'Node Report header section does not contain ' + c + ' version');
} else {
t.match(nodeReportSection,
new RegExp(c + ': ' + process.versions[c]),
new RegExp(c + ': ' + escapeRegex(process.versions[c])),
'Node Report header section contains expected ' + c + ' version');
}
}
Expand Down