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: a small common.skip() improvement proposal #14016

Closed
vsemozhetbyt opened this issue Jun 30, 2017 · 5 comments
Closed

test: a small common.skip() improvement proposal #14016

vsemozhetbyt opened this issue Jun 30, 2017 · 5 comments
Labels
test Issues and PRs related to the tests.

Comments

@vsemozhetbyt
Copy link
Contributor

Currently, common.skip() only outputs a message, so after each call, we need to add return; in tests — this is +~400 lines of code. Would it be safe to make this function like common.skipIfInspectorDisabled(), i.e. to add process.exit(0); in common.skip() and remove all the return; in tests? If there are some +1 for this proposal, I can try to raise a PR.

@addaleax
Copy link
Member

I think some test files are using it to partially skip tests, and let it print a skip message in the format that TAP understands; I’m not sure on the details, but you’d probably need to check the relevant files to see where there is actual code executed after the skip().

@Trott
Copy link
Member

Trott commented Jun 30, 2017

I think some test files are using it to partially skip tests, and let it print a skip message in the format that TAP understands; I’m not sure on the details, but you’d probably need to check the relevant files to see where there is actual code executed after the skip().

An example is test/parallel/test-buffer-alloc.js. (I'm actually not sure that isn't a code mistake TBH. I'm not sure TAP understands "partial skip". I think with TAP you either SKIP the test or you don't.)

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Jun 30, 2017

It seems we have ~10 tests with partial skip now if I skim properly. So would it be OK to just add a message via console.log() in these cases?

@addaleax
Copy link
Member

@vsemozhetbyt Either that, or you could just rename the current skip function to something else, common.printSkipMessage or whatever, then make skip a wrapper around that + process.exit.

@mscdex mscdex added the test Issues and PRs related to the tests. label Jul 1, 2017
@vsemozhetbyt
Copy link
Contributor Author

@addaleax @Trott
I've found out one case when return; is more appropriate than process.exit(0): if common.skip() is called after a common.mustCall(), then return; exits gracefully (with async callbacks fired) while process.exit(0) causes error. There are 2 such files:

parallel/test-dgram-bind-default-address.js
sequential/test-net-server-address.js

I've left them with common.printSkipMessage() + return;.

PR: #14021

@tniessen tniessen changed the title test: a smal common.skip() improvement proposal test: a small common.skip() improvement proposal Jul 2, 2017
addaleax pushed a commit that referenced this issue Jul 11, 2017
* Make common.skip() exit.

  Also add common.printSkipMessage() for partial skips.

* Don't make needless things before skip

PR-URL: #14021
Fixes: #14016
Reviewed-By: Refael Ackermann <[email protected]>
addaleax pushed a commit that referenced this issue Jul 18, 2017
* Make common.skip() exit.

  Also add common.printSkipMessage() for partial skips.

* Don't make needless things before skip

PR-URL: #14021
Fixes: #14016
Reviewed-By: Refael Ackermann <[email protected]>
Fishrock123 pushed a commit that referenced this issue Jul 19, 2017
* Make common.skip() exit.

  Also add common.printSkipMessage() for partial skips.

* Don't make needless things before skip

PR-URL: #14021
Fixes: #14016
Reviewed-By: Refael Ackermann <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 16, 2017
* Make common.skip() exit.

  Also add common.printSkipMessage() for partial skips.

* Don't make needless things before skip

Backport-PR-URL: #14838
PR-URL: #14021
Fixes: #14016
Reviewed-By: Refael Ackermann <[email protected]>
MylesBorins pushed a commit that referenced this issue Sep 5, 2017
* Make common.skip() exit.

  Also add common.printSkipMessage() for partial skips.

* Don't make needless things before skip

Backport-PR-URL: #14838
PR-URL: #14021
Fixes: #14016
Reviewed-By: Refael Ackermann <[email protected]>
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

No branches or pull requests

4 participants