Comments (6)
Thanks for this @Maxim-Filimonov - I'll take the time to digest soon, but in the meantime happy to hear everyone else's viewpoints on how the new interface is working for them.
Especially considering some of the changes from the Ruby core -> Rust core and the lifecycle changes.
I agree that the experience with using Jest and Pact JS is pretty nice as it is.
t seems to me that plain pact v3 syntax is way closer to jest and easier to understand. I have a clear separation between different interactions and only need to wrap my api calls with special executeTest method.
from jest-pact.
It seems to me that plain pact v3 syntax is way closer to jest and easier to understand.
I agree. I think at the time jest-pact's V3 support was written, the "plain" v3 syntax didn't exist, and it looks like it was jest-pact's V3 support was migrated from beta without reviewing it.
from jest-pact.
By the way, the intention for the interaction block being separate is that you should be able to do this:
pactWith(pactConfig, (interaction) => {
interaction('authentication api', ({ execute, provider }) => {
beforeEach(() => {
return provider.addInteraction(validUsername({ username }));
})
execute(
/* some positive case */
);
execute(
/* some negative case */
);
});
});
That could be clearer in the docs - although I'm not actually sure this is that nice. I didn't like the name execute
at the time.
While with jest-pact I'm getting confused as I would need to add a NEW interaction for every single interaction that I do even, so my interaction already has a name defined.
Doesn't this happen with your example too? Repeated tests would need the same interaction defined.
By interaction already has a name I mean my interaction already has:
Yeah. Ideally Jest-Pact should pass this on so you don't have to.
from jest-pact.
Hi @Maxim-Filimonov
You had to define a provider outside your describe section in your plain pact v3
example.
Did you define the provider in a separated file and have all your test files importing the same provider object?
Or is it defined in a beforeAll on each test file?
Why does jest-pact v3
is deconstructing: { execute, provider }
instead of letting us use provider.executeTest
?
Thanks
from jest-pact.
Because provider.executeTest
didn't exist at the time that the V3 part of jest-pact was written. It looks like the beta of jest-pact was promoted to the main release at the time of the pact-js v10 release without changes.
from jest-pact.
Hi @Maxim-Filimonov You had to define a provider outside your describe section in your
plain pact v3
example. Did you define the provider in a separated file and have all your test files importing the same provider object? Or is it defined in a beforeAll on each test file?
We just do this before describe block:
# pactConfig is just a static object from separate file
const provider = new PactV3(pactConfig);
from jest-pact.
Related Issues (20)
- Pact tests fail with timeout on pact server setup HOT 2
- Add cors flag in PactOptions HOT 5
- Log file does not contain data for all tests HOT 5
- Pact Verification Failed for multipart/form-data request HOT 2
- Support newer jest versions HOT 1
- future proofing `jest-pact` / `jasmine is undefined` HOT 2
- Race condition HOT 3
- Pact V3 support HOT 13
- Typescript Compiler failing with error TS2307 HOT 2
- jest-pact depends on Jasmine HOT 3
- Readme example - incorrect method name HOT 2
- Jest 27 support HOT 2
- "jest-pact": "0.9.0-beta.v3" not compatible "@pact-foundation/pact": "10.0.0-beta.45", HOT 3
- Error occurred in mock service: JSON::ParserError - 757: unexpected token at '"[{}]"' HOT 3
- Logging in jest-pact V3 Beta HOT 2
- move to pact-foundation org/scope HOT 6
- ci: move to GH actions
- pact-js 10.0.0 not compatible with jest-pact 0.9.0-beta.v3 HOT 2
- Jest 29 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-pact.