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 ability to override os.Exit for fxtest #1117

Open
codyaray opened this issue Sep 9, 2023 · 1 comment
Open

Add ability to override os.Exit for fxtest #1117

codyaray opened this issue Sep 9, 2023 · 1 comment

Comments

@codyaray
Copy link

codyaray commented Sep 9, 2023

Is your feature request related to a problem? Please describe.

We have a component test library for testing services (which use an uberfx-based library) as a blackbox. For this test framework we would like to catch all errors rather than exit the process.

As a bonus, it would be extra helpful if we had a good mechanism to test the actual error too (prior to os.Exit(1) being called), but understand that's a bigger scope - as long as that error is logged using the FX logger at least we can intercept that.

Describe the solution you'd like

I'd love to have an ability to override the osExit function used, similar to what's supported internally: #792

Describe alternatives you've considered

We've added our own timeouts in our test cases that developers set separately from FX timeouts. This is a recent comment that prompted me opening this ticket when it came up in a PR on our internal component test framework:
Screen Shot 2023-09-08 at 9 20 13 PM
cc @CTrando

Is this a breaking change?
No

Additional context
n/a

@sywhang sywhang changed the title Add ability to override os.Exit Add ability to override os.Exit for fxtest Sep 12, 2023
@sywhang
Copy link
Contributor

sywhang commented Sep 12, 2023

I believe this is a fair ask if we're discussing how we can override it for testing purposes. Retitled the issue to reflect that - we can add this to fxtest package that can be used for configuring a test App.

For more general-purpose configuration of App though, i don't think it makes much sense to override that since there's no way to stop user-provided code from calling os.Exit or override its behavior.

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

No branches or pull requests

2 participants