Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
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
28 changes: 27 additions & 1 deletion test/common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
'use strict';

const fs = require('fs');
const os = require('os');

const osMap = {
'aix': 'AIX',
'darwin': 'Darwin',
'linux': 'Linux',
'sunos': 'SunOS',
'win32': 'Windows',
};

const REPORT_SECTIONS = [
'Node Report',
Expand Down Expand Up @@ -48,7 +57,7 @@ exports.validateContent = function validateContent(data, t, options) {
const expectedVersions = options ?
options.expectedVersions || nodeComponents :
nodeComponents;
var plan = REPORT_SECTIONS.length + nodeComponents.length + 4;
var plan = REPORT_SECTIONS.length + nodeComponents.length + 5;
if (options.commandline) plan++;
t.plan(plan);
// Check all sections are present
Expand Down Expand Up @@ -115,6 +124,23 @@ exports.validateContent = function validateContent(data, t, options) {
'Checking machine name in report header section contains os.hostname()');
}

const osName = osMap[os.platform()];
const osVersion = nodeReportSection.match(/OS version: .*(?:\r*\n)/);
if (this.isWindows()) {
t.match(osVersion,
new RegExp('OS version: ' + osName), 'Checking OS version');
} else if (this.isAIX() && !os.release().includes('.')) {
// For Node.js prior to os.release() fix for AIX:
// https://github.com/nodejs/node/pull/10245
t.match(osVersion,
new RegExp('OS version: ' + osName + ' \\d+.' + os.release()),
'Checking OS version');
} else {
t.match(osVersion,
new RegExp('OS version: ' + osName + ' .*' + os.release()),
'Checking OS version');
}

// Check report System Information section
const sysInfoSection = getSection(reportContents, 'System Information');
// Find a line which ends with "/api.node" or "\api.node" (Unix or
Expand Down
34 changes: 0 additions & 34 deletions test/test-os-version.js

This file was deleted.