Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Improved tests in test-os #8606

Closed
wants to merge 1 commit into from
Closed

test: Improved tests in test-os #8606

wants to merge 1 commit into from

Conversation

delvedor
Copy link
Member

@delvedor delvedor commented Sep 17, 2016

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Affected test

test-os

Description of change
  • Moved all variables declaration from var to const
  • Moved from .equal to .strictEqual
  • Added more checks about the type of the returned values.

Part of code & learn.
Cc: @mcollina

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Sep 17, 2016
@mcollina
Copy link
Member

Can you please shorten the commit message and include the name of the test you are changing?

@mcollina
Copy link
Member

@delvedor
Copy link
Member Author

Done!

@delvedor delvedor changed the title test: Moved from var to const, equal to strictEqual and added typeof tests test: Improved tests in test-os Sep 17, 2016
@mcollina
Copy link
Member

@mscdex mscdex added the os Issues and PRs related to the os subsystem. label Sep 17, 2016
@addaleax
Copy link
Member

That failure looks more like a build problem that might be fixed by just cleaning up on the build machine? /cc @nodejs/build

delete process.env.HOME;
assert.ok(os.homedir().indexOf(path.sep) !== -1);
process.env.HOME = home;
}

const pwd = os.userInfo();
console.log('pwd = ', pwd);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you remove this.

const path = require('path');

const is = {
string: (value) => { assert.ok(typeof value === 'string'); },
Copy link
Contributor

Choose a reason for hiding this comment

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

These could be, for example, assert.strictEqual(typeof value, 'string');.

string: (value) => { assert.ok(typeof value === 'string'); },
number: (value) => { assert.ok(typeof value === 'number'); },
array: (value) => { assert.ok(Array.isArray(value)); },
object: (value) => { assert.ok(typeof value === 'object'); }
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also check for null.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, originally I wrote the not null test here, but since typeof null === 'object' I thought the is.object with this check was a nonsense.
Anyhow, now I added it again, let me know if something else is missing :)

Copy link
Contributor

@Fishrock123 Fishrock123 left a comment

Choose a reason for hiding this comment

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

See @cjihrig's comments

@jbergstroem
Copy link
Member

Cleaning up the host now.

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM, can you please squash the commits?

Moved from var to const.
Moved from .equal to .strictEqual.
Added more checks about the type of the returned values.
@imyller imyller self-assigned this Sep 20, 2016
@imyller
Copy link
Member

imyller commented Sep 20, 2016

@imyller
Copy link
Member

imyller commented Sep 20, 2016

@Fishrock123 Could you revise your review. I think the issues mentioned have been addressed.

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

LGTM

@imyller
Copy link
Member

imyller commented Sep 21, 2016

Any objections to start landing this?

I see that there are four LGTMs for Reviewed-By and the requested code changes have been made.

@jasnell
Copy link
Member

jasnell commented Sep 21, 2016

Go for it!

@imyller
Copy link
Member

imyller commented Sep 21, 2016

I'll start landing this:

  • Five LGTMs
  • No objections
  • Requested code changes have been completed
  • CI tests passed (only usual CI failures)

imyller pushed a commit to imyller/node that referenced this pull request Sep 21, 2016
Moved from var to const.
Moved from .equal to .strictEqual.
Added more checks about the type of the returned values.

PR-URL: nodejs#8606
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
@imyller
Copy link
Member

imyller commented Sep 21, 2016

landed in 66df5d1

Thank you for your contribution, @delvedor

@imyller imyller closed this Sep 21, 2016
@imyller imyller removed their assignment Sep 21, 2016
@delvedor delvedor deleted the test-os branch September 21, 2016 08:23
Fishrock123 pushed a commit that referenced this pull request Oct 11, 2016
Moved from var to const.
Moved from .equal to .strictEqual.
Added more checks about the type of the returned values.

PR-URL: #8606
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os Issues and PRs related to the os subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.