Skip to content

Support for callback function to skip tests #26

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

Merged

Conversation

lws803
Copy link
Contributor

@lws803 lws803 commented Aug 24, 2022

Addition of a skipTest callback function param which provides a higher degree of customization to determine if a test should be skipped or not.

this could potentially make the skipTestNames param redundant earlier but I'd leave it there for backwards compatibility just in case someone has already started using it 👍

@ValentinH
Copy link
Owner

There is already a silenceMessage function, could it provide what you need?
Otherwise, it could be nice to extend it to match your needs.

@lws803
Copy link
Contributor Author

lws803 commented Aug 24, 2022

There is already a silenceMessage function, could it provide what you need?

Unfortunately not :x since silenceMessage works for skipping specific error messages like:

Warning: React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.

which is pretty generic and happens across multiple test suites 😄 we're trying to ignore only specific files and not for all error messages of that kind

Otherwise, it could be nice to extend it to match your needs.

Not too sure if they're the same thing though 🤔 since silencing messages are used for silencing messages from the error message output. I would extend skipTest to include the ability to silence messages as well (instead of extending on silenceMessage param) to make it more generic but I'll leave that to your discretion 👍

@ValentinH
Copy link
Owner

Ok I get your point. Let's keep like this. However I would remove the skipTestNames option. I have no issue with bumping a major release to be safe.

One last thing, could you add one test case for th renew option please?

@lws803
Copy link
Contributor Author

lws803 commented Aug 24, 2022

Ok I get your point. Let's keep like this. However I would remove the skipTestNames option. I have no issue with bumping a major release to be safe.

One last thing, could you add one test case for th renew option please?

Added as of previous 2 commits 😄

Copy link
Owner

@ValentinH ValentinH left a comment

Choose a reason for hiding this comment

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

Looks good to me. I'm on the phone now, I'll finish the review, merge and release when I'm back on the computer 🙂

@@ -29,6 +29,12 @@ describe('jest-fail-on-console', () => {
expect(stderr).toEqual(expect.stringContaining(passString('error-disabled')))
})

it.only('does not error when console.error() is called and skip test returns true', async () => {
Copy link
Owner

Choose a reason for hiding this comment

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

skip should be removed 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, my bad 😅 got too used to linters warning me about this 3175ba9

Copy link
Owner

Choose a reason for hiding this comment

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

Yes I understand, same here!

@lws803 lws803 requested a review from ValentinH August 25, 2022 05:37
@lws803
Copy link
Contributor Author

lws803 commented Aug 26, 2022

Hey @ValentinH any word on reviewing this PR? 😄 Just wanted to make sure it wasn't forgotten, no rush if you're busy atm 👍

@ValentinH
Copy link
Owner

I'll merge this on Monday. Sorry for the delay .

@ValentinH ValentinH merged commit 6336c58 into ValentinH:main Aug 27, 2022
@ValentinH
Copy link
Owner

Released as https://github.com/ValentinH/jest-fail-on-console/releases/tag/v3.0.0 🚀

@lws803 lws803 deleted the support-for-callback-function-to-skip-tests branch August 27, 2022 13:10
@lws803
Copy link
Contributor Author

lws803 commented Aug 27, 2022

Released as https://github.com/ValentinH/jest-fail-on-console/releases/tag/v3.0.0 🚀

Yayy thank you! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants