-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Conversation
Can you please shorten the commit message and include the name of the test you are changing? |
Done! |
https://ci.nodejs.org/job/node-test-commit-arm/5000/nodes=ubuntu1604-arm64/ failed. Seems highly unrelated. |
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); |
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.
Could you remove this.
const path = require('path'); | ||
|
||
const is = { | ||
string: (value) => { assert.ok(typeof value === 'string'); }, |
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.
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'); } |
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.
This should also check for null
.
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.
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 :)
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.
See @cjihrig's comments
Cleaning up the host now. |
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.
LGTM
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.
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.
@Fishrock123 Could you revise your review. I think the issues mentioned have been addressed. |
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.
LGTM
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.
LGTM
Any objections to start landing this? I see that there are four LGTMs for |
Go for it! |
I'll start landing this:
|
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>
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>
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Affected test
test-os
Description of change
Part of code & learn.
Cc: @mcollina