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: improve fs error message test #18277

Closed
wants to merge 4 commits into from

Conversation

joyeecheung
Copy link
Member

In preparation for more fs error migrations..

  • Reuse error validators for sync and async tests
  • Validate properties of the errors
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

- Reuse error validators for sync and async tests
- Validate properties of the errors
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jan 21, 2018
@joyeecheung
Copy link
Member Author

joyeecheung commented Jan 21, 2018

assert.strictEqual(nonexistentFile, err.path);
// Could be resolved to an absolute path
assert.ok(err.dest.endsWith('foo'),
`expect ${err.dest} to ends with 'foo'`);
Copy link
Member

Choose a reason for hiding this comment

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

nit: to end

assert.strictEqual(nonexistentFile, err.path);
// Could be resolved to an absolute path
assert.ok(err.dest.endsWith('foo'),
`expect ${err.dest} to ends with 'foo'`);
Copy link
Member

Choose a reason for hiding this comment

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

ditto

} catch (err) {
errors.push('opens');
assert.ok(err.message.includes(fn));
// rmdir
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: rmdir on a file

} catch (err) {
errors.push('readdir');
assert.ok(err.message.includes(fn));
// read
Copy link
Member

Choose a reason for hiding this comment

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

readFile

@joyeecheung
Copy link
Member Author

joyeecheung commented Jan 22, 2018

@joyeecheung
Copy link
Member Author

Only one unrelated failure in the last CI. Fired another one just in case: https://ci.nodejs.org/job/node-test-pull-request/12664/

@joyeecheung joyeecheung added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 22, 2018
@joyeecheung
Copy link
Member Author

Landed in 63f78f5, thanks!

joyeecheung added a commit that referenced this pull request Jan 23, 2018
- Reuse error validators for sync and async tests
- Validate properties of the errors

PR-URL: #18277
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@joyeecheung joyeecheung removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 23, 2018
@MylesBorins
Copy link
Contributor

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

MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
- Reuse error validators for sync and async tests
- Validate properties of the errors

PR-URL: nodejs#18277
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@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
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants