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

Replaced 'assert.throws' with 'common.expectsError' #30186

Closed
wants to merge 1 commit into from

Conversation

mpark86
Copy link
Contributor

@mpark86 mpark86 commented Oct 31, 2019

Modified test/js-native-api/test_bigint/test.js to use common.expectsError instead of assert.throws.

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 31, 2019
@cjihrig
Copy link
Contributor

cjihrig commented Oct 31, 2019

The modified test is failing in the Travis CI run.

@mpark86
Copy link
Contributor Author

mpark86 commented Oct 31, 2019

I'll take a look at it. Is there a way to check that locally?

@cjihrig
Copy link
Contributor

cjihrig commented Oct 31, 2019

make test will run the test suite locally. Since you've only changed on test, node test/js-native-api/test_bigint/test.js should be enough.

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.

I personally am -0 for this change. I would actually like to move more common.expectsError calls to use assert.throws. But it's not worth the churn to actually change them.

@Trott
Copy link
Member

Trott commented Nov 3, 2019

I'm with @BridgeAR on this. We should favor assert.throws() and avoid people having to learn our custom module where possible. If there are features in common.expectsError() that aren't in assert.throws(), we can consider adding them.

@richardlau
Copy link
Member

It would be helpful to add some documentation to common.expectsError() to indicate when it should be used (and to direct test writers to use assert.throws() in the other cases).

@BridgeAR
Copy link
Member

@mpark86 thank you very much for your contribution! I'll close this PR though, due to the reasons mentioned above.

I opened #31092 to refactor common.expectsError() in a way that it is only possible to use as callback function. That way the confusion about it's usage will also be solved.

@BridgeAR BridgeAR closed this Dec 25, 2019
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.

6 participants