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: use global hook for setup and teardown #2

Merged
merged 1 commit into from
Mar 14, 2021

Conversation

marcosvega91
Copy link

Hello Matt,

I have updated your code a little bit. I have moved the setup of MSW into before and after function in a global file. What do you think?

@msutkowski
Copy link
Owner

Hello Matt,

I have updated your code a little bit. I have moved the setup of MSW into before and after function in a global file. What do you think?

I'll have to check it when I get home in a few hours, but the global hooks will most likely fail in watch mode.

@msutkowski
Copy link
Owner

Hello Matt,

I have updated your code a little bit. I have moved the setup of MSW into before and after function in a global file. What do you think?

I'll have to check it when I get home in a few hours, but the global hooks will most likely fail in watch mode.

@marcosvega91 actually, this should work. I think the server instance is still going to be recreated though? Have you tried running this with test:watch?

@marcosvega91
Copy link
Author

Yes I have tried with with and without it and seems working. The instance server is run one time on every restart. So if I change the code, watch will run my test again closing the previous server and starting a new one

@msutkowski
Copy link
Owner

Yes I have tried with with and without it and seems working. The instance server is run one time on every restart. So if I change the code, watch will run my test again closing the previous server and starting a new one

Great! Thanks again for your help! I'll do some more testing where it's running parallel with multiple CPUs as well and if that all works out we're good to go

@marcosvega91
Copy link
Author

Happy to be useful someway :).

@msutkowski msutkowski merged commit d1a6b57 into msutkowski:master Mar 14, 2021
This pull request was closed.
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.

2 participants