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: replace fs.accessAsync with common.fileExists #17222

Closed
wants to merge 1 commit into from

Conversation

df1
Copy link

@df1 df1 commented Nov 22, 2017

replace calls to fs.accessAsync with common.fileExists in test/parallel/test-npm-install.js

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

replace calls to `fs.accessAsync` with `common.fileExists` in `test/parallel/test-npm-install.js`
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Nov 22, 2017
@df1 df1 changed the title replace fs.accessAsync with common.fileExists test: replace fs.accessAsync with common.fileExists Nov 22, 2017
Copy link
Contributor

@MylesBorins MylesBorins left a comment

Choose a reason for hiding this comment

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

LGTM

@MylesBorins
Copy link
Contributor

@MylesBorins MylesBorins added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Nov 22, 2017
@mscdex mscdex added the npm Issues and PRs related to the npm client dependency or the npm registry. label Nov 22, 2017
@@ -58,6 +58,6 @@ function handleExit(error, stdout, stderr) {
assert.strictEqual(code, 0, `npm install got error code ${code}`);
assert.strictEqual(signalCode, null, `unexpected signal: ${signalCode}`);
assert.doesNotThrow(function() {
fs.accessSync(`${installDir}/node_modules/package-name`);
common.fileExists(`${installDir}/node_modules/package-name`);
Copy link
Contributor

Choose a reason for hiding this comment

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

common.fileExists() doesn't throw, so assert.doesNotThrow() is redundant. Either leave as is, or assert on the return value from common.fileExists().

Side note: common.fileExists() isn't necessary anymore. It was added when fs.exists() was scheduled for deprecation and removal.

Copy link
Contributor

Choose a reason for hiding this comment

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

should is maybe be replaced with fs.exists?

Do you think this PR should be closed? If so should we maybe have @df1 remove some instances of common.fileExists?

Copy link
Author

Choose a reason for hiding this comment

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

@MylesBorins do you mean fs.stat() or fs.access()?
Since fs.exists() is deprecated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for saying fs.exists(), when I meant fs.existsSync(). I'd be +1 to removing common.fileExists() and replacing it with fs.existsSync().

This particular change should either be backed out, or updated to use existsSync() without assert.doesNotThrow().

@maclover7
Copy link
Contributor

ping @df1

@apapirovski
Copy link
Member

Hi @df1 — thank you for trying to improve Node.js. It appears that a similar change has landed recently but I hope you get a chance to contribute again in the future! Thanks again.

@apapirovski apapirovski closed this Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. npm Issues and PRs related to the npm client dependency or the npm registry. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants