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

Add skip(...) function for skipping the current test #4918

Closed
shazow opened this issue May 10, 2023 · 2 comments
Closed

Add skip(...) function for skipping the current test #4918

shazow opened this issue May 10, 2023 · 2 comments
Labels
T-feature Type: feature

Comments

@shazow
Copy link

shazow commented May 10, 2023

Component

Forge

Describe the feature you would like

Sometimes it's useful to set tests to be skipped, such as:

  • When a test is transiently broken
  • If the current environment does not support running a particular test
  • Some tests are particularly slow, and would be convenient to only run them when an env variable is set. (Hypothetically, haven't run into these myself yet 😅)

More specific example: I have some end-to-end integration tests that rely on forking a live RPC, but sometimes the test suite is run in offline environments which results in the forking process failing due to lacking an RPC to work with. I'd prefer to catch that scenario, a message like "Skipping fooTest: ETH_RPC_URL not set".

(Bonus points if this is also callable inside setUp())

Would love a skip(string message) function which marks the current test as neither passed nor failed, bails, and prints the message when skipping it.

Additional context

Not sure if this should be part of forge-std, or needs to be part of a vm cheatcode? I suspect some changes would need to be made in forge also?

API Examples:

@shazow shazow added the T-feature Type: feature label May 10, 2023
@gakonst gakonst added this to Foundry May 10, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry May 10, 2023
@mds1
Copy link
Collaborator

mds1 commented May 10, 2023

Agreed this would be useful and should be callable from setUp. Seems like a duplicate of vm.skip(bool) from #1123 (comment)

@shazow
Copy link
Author

shazow commented May 10, 2023

@mds1 Good call, I missed #1123, very similar. Bonus points if a message can be optionally included, but can always console.log ahead of it. Closing as dupe.

@shazow shazow closed this as completed May 10, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry May 10, 2023
@shazow shazow closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
Archived in project
Development

No branches or pull requests

2 participants