Skip to content

test: extended test to makeCallback cb type check - #12140

Closed
lucamaraschi wants to merge 1 commit into
nodejs:masterfrom
lucamaraschi:test-fs-makeCallback
Closed

test: extended test to makeCallback cb type check#12140
lucamaraschi wants to merge 1 commit into
nodejs:masterfrom
lucamaraschi:test-fs-makeCallback

Conversation

@lucamaraschi

Copy link
Copy Markdown
Contributor

makeCallback and makeStatsCallback are both tested intedependently.

Fixes: #12136

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

test, fs

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Mar 30, 2017
@mscdexmscdex added the fs Issues and PRs related to the fs subsystem / file system. label Mar 30, 2017

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.

s/Thows/Throws/ ?

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.

Doesn't this delete the file? How about using another method that calls makeCallback() like, I don't know, fs.chmod()?
The comment should also be updated.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good point...but any of the operations which are calling makeCallback have an impact on the file. I would then use fs.mkdtemp which only creates a temp dir which we can delete at the end of the test. Does it make sense to you @lpinca?

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.

Yes works for me.

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.

s/Thows/Throws/ ?

@jasnelljasnell left a comment

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.

LGTM. One suggestion tho: the process.once('warning', ...) bit can be replaced by a call to common.expectWarning(...)

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.

Can you remove this.

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.

Should this be os.tmpdir()? Alternatively, there is common.tmpDir for use in tests.

@lucamaraschi
lucamaraschiforce-pushed the test-fs-makeCallback branch 2 times, most recently from 424fcb6 to 21f94d7CompareMarch 31, 2017 22:45

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.

This throws an error if the test is run in isolation node test/parallel/test-fs-make-callback.js and common.tmpDir has not been created.

I think it makes sense to run common.refreshTmpDir() at the beginning of the test.

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.

I'd use common.expectWarning() for consistency.

makeCallback and makeStatsCallback are both tested intedependently.
Fixes: nodejs#12136

@mhdawsonmhdawson left a comment

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.

LGTM

@mhdawson

Copy link
Copy Markdown
Member

@mhdawson

Copy link
Copy Markdown
Member

CI is green landing

@mhdawson
mhdawson requested review from thefourtheye and removed request for thefourtheyeApril 3, 2017 17:32
@mhdawson

Copy link
Copy Markdown
Member

landed as 53828e8

@mhdawsonmhdawson closed this Apr 3, 2017
mhdawson pushed a commit that referenced this pull request Apr 3, 2017
makeCallback and makeStatsCallback are both tested intedependently.
PR-URL: #12140Fixes: #12136
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@jasnelljasnell mentioned this pull request Apr 4, 2017
@gibfahngibfahn mentioned this pull request Jun 15, 2017
3 tasks
@gibfahn

Copy link
Copy Markdown
Member

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if no let me know or add the dont-land-on label.

@targos

Copy link
Copy Markdown
Member

I'm backporting this with #12270

gibfahn pushed a commit that referenced this pull request Jun 19, 2017
makeCallback and makeStatsCallback are both tested intedependently.
PR-URL: #12140
Backport-PR-URL: #13785Fixes: #12136
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
gibfahn pushed a commit that referenced this pull request Jun 20, 2017
makeCallback and makeStatsCallback are both tested intedependently.
PR-URL: #12140
Backport-PR-URL: #13785Fixes: #12136
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2017
makeCallback and makeStatsCallback are both tested intedependently.
PR-URL: #12140
Backport-PR-URL: #13785Fixes: #12136
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@MylesBorinsMylesBorins mentioned this pull request Jul 18, 2017
abhishekumar-tyagi pushed a commit to abhishekumar-tyagi/node that referenced this pull request May 5, 2024
makeCallback and makeStatsCallback are both tested intedependently.
PR-URL: nodejs/node#12140Fixes: nodejs/node#12136
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fsIssues and PRs related to the fs subsystem / file system.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@lucamaraschi@mhdawson@gibfahn@targos@jasnell@lpinca@cjihrig@mscdex@italoacasas@nodejs-github-bot