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: Z lib const descriptive failure messages #15977

Conversation

AlecHFerguson
Copy link

@AlecHFerguson AlecHFerguson commented Oct 6, 2017

More informative failure messages for ZLib constants tests. Using template literals to output the actual value in addition to expected.

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

test

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 6, 2017
[
'Expected Z_OK to be 0;',
`got ${zlib.constants.Z_OK}`
].join(' '));
Copy link
Author

Choose a reason for hiding this comment

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

I'm not a fan of this formatting, but I had to adhere to linter rules; specifically, max line length of 80. I would prefer format like this:

assert.strictEqual(zlib.codes.Z_OK, 0,
          `Z_OK should be immutable. Expected to get 0, got ${zlib.codes.Z_OK}`);

What would folks think about overriding the max-line-length linter rule to 120 characters for this file?

Copy link
Contributor

Choose a reason for hiding this comment

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

That is what is done in test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js by adding /* eslint-disable max-len */.

Copy link
Author

Choose a reason for hiding this comment

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

Ah, nice. That's what I had in mind to do. Guess I didn't want to rock the linting rules boat on my first contribution to Node, eh? Ha! Will override here.

Copy link
Member

Choose a reason for hiding this comment

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

This would also work

assert.strictEqual(
  zlib.constants.Z_OK,
  0,
  `Expected Z_OK to be 0; got ${zlib.constants.Z_OK}`
);

Deactiviating the max-len is not a good idea.

@mscdex mscdex added the zlib Issues and PRs related to the zlib subsystem. label Oct 6, 2017
@Trott Trott added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Oct 7, 2017
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

It would be nice to have the suggested formatting but this is not a must out of my perspective.

The subsystem is wrong right now and has to be changed while landing.

@BridgeAR BridgeAR changed the title Z lib const descriptive failure messages test: Z lib const descriptive failure messages Oct 7, 2017
@BridgeAR
Copy link
Member

BridgeAR commented Oct 7, 2017

@refack
Copy link
Contributor

refack commented Oct 7, 2017

CI is ✔️
Single CI failure is unrelated.

@BridgeAR BridgeAR self-assigned this Oct 8, 2017
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Oct 8, 2017
PR-URL: nodejs#15977
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@BridgeAR
Copy link
Member

BridgeAR commented Oct 8, 2017

Landed in 91724cb

Thanks for the PR, and congratulations on becoming a Node.js Contributor 🎉 !

@BridgeAR BridgeAR closed this Oct 8, 2017
MylesBorins pushed a commit that referenced this pull request Oct 11, 2017
PR-URL: #15977
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Oct 11, 2017
addaleax pushed a commit to addaleax/ayo that referenced this pull request Oct 12, 2017
PR-URL: nodejs/node#15977
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
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. test Issues and PRs related to the tests. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants