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

feat: reset consumer test state to enable re-use of PactV3 class #704

Merged
merged 2 commits into from Jun 29, 2021

Conversation

mefellows
Copy link
Member

@mefellows mefellows commented Jun 28, 2021

Wipes the internal state between test runs to enable re-use of the provider.

Not thread safe (it wasn't before), but if you want to run in parallel you can still create multiple providers as per what is currently the case, and the pact will be merged.

@TimothyJones
Copy link
Contributor

Nice! Is configure the best name? It sounds a bit similar to setup to me.

I think the non thread safeness is probably ok because node is single threaded- even when just runs more than one test at once, it’s not sharing memory between the tests. Am I missing anything?

@mefellows
Copy link
Member Author

setup is probably better.

I think the non thread safeness is probably ok because node is single threaded- even when just runs more than one test at once, it’s not sharing memory between the tests. Am I missing anything?

Not really, the main point is that if you want to allow parallel tests, you should create multiple providers. I think that's fixable though, we'd just need to track multiple pact instances to specific executeTest functions. Separate problem for another day.

Also prettier just lost it with me. I'll update this first, and do a prettier fix in a separate push.

@mefellows mefellows force-pushed the feat/automatically-reset-state branch from 7850128 to 0134ea8 Compare June 29, 2021 01:42
@mefellows mefellows marked this pull request as ready for review June 29, 2021 02:47
@mefellows mefellows merged commit f7a1cdc into feat/v3.0.0 Jun 29, 2021
@mefellows mefellows deleted the feat/automatically-reset-state branch June 29, 2021 02:53
@TimothyJones
Copy link
Contributor

I think the prettier problem is something to do with my local setup. CI and your prettier seem to agree, I don't know what's going on locally for me.

@mefellows
Copy link
Member Author

no, I re-ran npm run format:fix and it "fixed" a bunch of files. Same problem it seems!

@TimothyJones
Copy link
Contributor

It was broken after I pushed formatting changes that my local wanted (I had incorrectly assumed someone merged something that didn’t build)

@mefellows
Copy link
Member Author

ah, thanks for clarifying!

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