-
-
Notifications
You must be signed in to change notification settings - Fork 36
Add command line to nodereport. #34
Changes from 4 commits
d5673b8
412efb4
1294c2a
dd20187
5872102
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,18 +36,18 @@ exports.validate = (t, report, options) => { | |
| const expectedVersions = options ? | ||
| options.expectedVersions || nodeComponents : | ||
| nodeComponents; | ||
| const plan = REPORT_SECTIONS.length + nodeComponents.length + 2; | ||
| var plan = REPORT_SECTIONS.length + nodeComponents.length + 2; | ||
| if( options.commandline ) plan++; | ||
|
||
| t.plan(plan); | ||
|
|
||
| // Check all sections are present | ||
| REPORT_SECTIONS.forEach((section) => { | ||
| t.match(reportContents, new RegExp('==== ' + section), | ||
| 'Checking report contains ' + section + ' section'); | ||
| }); | ||
|
|
||
| // Check NodeReport section | ||
| // Check NodeReport header section | ||
| const nodeReportSection = getSection(reportContents, 'NodeReport'); | ||
| t.match(nodeReportSection, new RegExp('Process ID: ' + pid), | ||
| t.contains(nodeReportSection, new RegExp('Process ID: ' + pid), | ||
|
||
| 'NodeReport section contains expected process ID'); | ||
| if (options && options.expectNodeVersion === false) { | ||
| t.match(nodeReportSection, /Unable to determine Node.js version/, | ||
|
|
@@ -57,6 +57,19 @@ exports.validate = (t, report, options) => { | |
| new RegExp('Node.js version: ' + process.version), | ||
| 'NodeReport section contains expected Node.js version'); | ||
| } | ||
| if (options && options.commandline) { | ||
| if (this.isWindows()) { | ||
| // On Windows we need to strip out double quotes from the command line in the | ||
| // report, and escape the backslashes in the regex comparison string. | ||
| t.match(nodeReportSection.replace(/"/g,''), | ||
| new RegExp('Command line: ' + (options.commandline).replace(/\\/g,'\\\\')), | ||
|
||
| 'Checking report contains expected command line'); | ||
| } else { | ||
| t.match(nodeReportSection, | ||
| new RegExp('Command line: ' + options.commandline), | ||
| 'Checking report contains expected command line'); | ||
| } | ||
| } | ||
| nodeComponents.forEach((c) => { | ||
| if (c !== 'node') { | ||
| if (expectedVersions.indexOf(c) === -1) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation for this
#elifblock is different from the rest of this function, please can you make it consistent?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the function was wrong and didn't match the file. I'd indented when starting #ifdef sections. I've adjusted the rest of the function to be correct.