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: add cb error test for fs.close method #29970

Closed
wants to merge 3 commits into from

Conversation

teorossi82
Copy link
Contributor

@teorossi82 teorossi82 commented Oct 14, 2019

Added test on fs.close method when callback is not a function.

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

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 14, 2019
@Fishrock123
Copy link
Member

Copy link
Member

@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.

Please call fs.closeSync(fd) at the bottom of the test file.

(Or, better, put the test case in a callback, and then have the close be async too. If you do that, make sure you wrap the callbacks in common.mustCall().)

@Trott
Copy link
Member

Trott commented Oct 14, 2019

I wouldn't mind these new lines being block-scoped (add a { before the new block and a } after) so that fd doesn't leak out to other test cases added later.

@Trott
Copy link
Member

Trott commented Oct 15, 2019

Out of curiosity, what caused you to write this test? Were you reviewing coverage.nodejs.org and this test is intended to add coverage where we currently don't have coverage? Or is there a different reason you're doing this?

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

LGTM with a closeSync() added after the forEach stuff.

const errObj = {
code: 'ERR_INVALID_CALLBACK',
name: 'TypeError'
};
Copy link
Member

Choose a reason for hiding this comment

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

Minor nit-pick: You can move the errObj definition outside of the forEach() to below the fd definition. This way, it's only being defined once.

@teorossi82
Copy link
Contributor Author

Out of curiosity, what caused you to write this test?

I have just took a look to coverage.nodejs.org page and found that this piece of code was not covered. I would like to help you reach 100% coverage :-)

@nodejs-github-bot
Copy link
Collaborator

@Trott
Copy link
Member

Trott commented Oct 15, 2019

CI (probably) won't pass until #29979 lands first. If a Collaborator wants to be the second fast-track approval on that PR, thumbs up at #29979 (comment).

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 16, 2019
@teorossi82
Copy link
Contributor Author

@Trott I have to do something to unlock problems with CI or it's not related to my changes and I just have to wait?

@Trott
Copy link
Member

Trott commented Oct 16, 2019

@Trott I have to do something to unlock problems with CI or it's not related to my changes and I just have to wait?

CI is passing. The GitHub interface doesn't always update. Not sure if that's a problem with our bot or with GitHub or something else. But this is all good to go. You don't need to do anything but wait for someone to land it. Which I'm going to do right now!

Trott pushed a commit that referenced this pull request Oct 16, 2019
Provides some missing test coverage.

PR-URL: #29970
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@Trott
Copy link
Member

Trott commented Oct 16, 2019

Landed in e22efba.

Thanks for the contribution! 🎉

@Trott Trott closed this Oct 16, 2019
MylesBorins pushed a commit that referenced this pull request Oct 23, 2019
Provides some missing test coverage.

PR-URL: #29970
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Oct 23, 2019
targos pushed a commit that referenced this pull request Nov 8, 2019
Provides some missing test coverage.

PR-URL: #29970
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Nov 10, 2019
Provides some missing test coverage.

PR-URL: #29970
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants