Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
Closed
Changes from 1 commit
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
Prev Previous commit
Drop redundant if test. Wrap long lines.
  • Loading branch information
richardlau committed Feb 14, 2017
commit 854f86ba46c7027d52c5123e293a76e0c43b4220
16 changes: 11 additions & 5 deletions test/test-os-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ const os_name = os_map[os.platform()];
const report_str = nodereport.getReport();
const version_str = report_str.match(/OS version: .*(?:\r*\n)/);
if (common.isWindows()) {
tap.match(version_str, new RegExp('OS version: ' + os_name), 'Checking OS version');
tap.match(version_str,
new RegExp('OS version: ' + os_name), 'Checking OS version');
} else if (common.isAIX() && !os.release().includes('.')) {
Copy link
Copy Markdown
Member

@gibfahn gibfahn Feb 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think .includes() is there in Node v4.

But obviously we can check by running CI with Node v4.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a node v4.0.0 repl that seems to work:

$ node-v4.0.0-darwin-x64/bin/node
> os.release().includes('.')
true

It should be fine on v4.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you're right. I think it's Array.includes() that isn't there in v4, string.includes() is.

// For Node.js prior to os.release() fix for AIX: https://github.com/nodejs/node/pull/10245
tap.match(version_str, new RegExp('OS version: ' + os_name + ' \\d+.' + os.release()), 'Checking OS version');
} else if (!common.isWindows()) {
tap.match(version_str, new RegExp('OS version: ' + os_name + ' .*' + os.release()), 'Checking OS version');
// For Node.js prior to os.release() fix for AIX:
// https://github.com/nodejs/node/pull/10245
tap.match(version_str,
new RegExp('OS version: ' + os_name + ' \\d+.' + os.release()),
'Checking OS version');
} else {
tap.match(version_str,
new RegExp('OS version: ' + os_name + ' .*' + os.release()),
'Checking OS version');
}