Skip to content
Closed
Show file tree
Hide file tree
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
Next Next commit
Unset aix flaky, remove loop for toPrimitive tests
  • Loading branch information
viktor-ku committed Sep 25, 2017
commit c923d4e4a6459169bdee230582e6fcda04e3f3fd
3 changes: 0 additions & 3 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@ test-npm-install: PASS,FLAKY
[$system==solaris] # Also applies to SmartOS

[$system==freebsd]

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.

Unrelated change. Please add that back in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's odd because I have this last line in my editor

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.

This shows two lines at the end of the file (i.e. the file ends in \n\n - one shows up as a new line, and the other as an EOF \n which is required...)

[$system==aix]
test-os: PASS,FLAKY
36 changes: 21 additions & 15 deletions test/parallel/test-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ const path = require('path');
const { inspect } = require('util');

const is = {
number: (value, key) => {
assert(!isNaN(value), `${key} should not be NaN`);
assert.strictEqual(typeof value, 'number');
},
string: (value) => { assert.strictEqual(typeof value, 'string'); },
number: (value) => { assert.strictEqual(typeof value, 'number'); },
array: (value) => { assert.ok(Array.isArray(value)); },
object: (value) => {
assert.strictEqual(typeof value, 'object');
Expand Down Expand Up @@ -217,17 +220,20 @@ assert.ok(pwd.homedir.includes(path.sep));
assert.strictEqual(pwd.username, pwdBuf.username.toString('utf8'));
assert.strictEqual(pwd.homedir, pwdBuf.homedir.toString('utf8'));

// Test Symbol.toPrimitive on these functions
[
[+os.freemem, os.freemem()],
[+os.totalmem, os.totalmem()],
[+os.uptime, os.uptime()],
[`${os.hostname}`, os.hostname()],
[`${os.homedir}`, os.homedir()],
[`${os.release}`, os.release()],
[`${os.type}`, os.type()],
[`${os.endianness}`, os.endianness()],
[`${os.tmpdir}`, os.tmpdir()],
[`${os.arch}`, os.arch()],
[`${os.platform}`, os.platform()]
].forEach(([expected, actual]) => assert.strictEqual(expected, actual));
assert.strictEqual(String(os.hostname), os.hostname());
assert.strictEqual(String(os.homedir), os.homedir());
assert.strictEqual(String(os.release), os.release());
assert.strictEqual(String(os.type), os.type());
assert.strictEqual(String(os.endianness), os.endianness());
assert.strictEqual(String(os.tmpdir), os.tmpdir());
assert.strictEqual(String(os.arch), os.arch());
assert.strictEqual(String(os.platform), os.platform());

assert.strictEqual(Number(os.totalmem), os.totalmem());
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.

Nit: I think it is easier to read to stick to the template strings and to + for strings. But this is not blocking.


// At least we can check that these values are numbers
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.

Suggestion: change comment to:

// Assert that the following values are coercible to numbers.

is.number(Number(os.uptime), 'uptime');
is.number(os.uptime(), 'uptime');

is.number(Number(os.freemem), 'freemem');
is.number(os.freemem(), 'freemem');