pact-foundation / pact-js

JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
https://pact.io
Other
1.59k stars 343 forks source link

Add an example using Vitest #1023

Closed arthuraulin closed 1 year ago

arthuraulin commented 1 year ago

Checklist

Before making a feature request, I have:

Feature description

Add an example using Vitest as runner

Use case

When switching to Vite on a Vue application, I also replaced Jest with Vitest - however I'm struggling a bit to have my pact tests running as before. This issue makes me think it should be doable, but having a full example in the repo would be really helpful. Thanks!

mefellows commented 1 year ago

Thanks. My first thought was "not another test framework!" :P (this is one thing I love about Golang - there's just one that everyone uses and it's great that there aren't a million ways to write tests). Diatribe aside, if you do manage to get it working, I'd consider accepting a PR to this repo (or perhaps a document explaining how to do it with Vite), but i've already been thinking (and this) having all of the examples in this repo is causing maintenance issues for me, so I'm not sure I'm currently open to doing so.

I'll leave this open as a discussion for now at least.

TimothyJones commented 1 year ago

See my comment on the other issue - I think the problem is that vitest says it's jest compatible, but it isn't.

TimothyJones commented 1 year ago

Here is a link to the documentation, where they give a type signature for their beforeAlland then go on to describe behaviour that contradicts it ¯\_(ツ)_/¯

mefellows commented 1 year ago

Closing this due to inactivity. Do feel free to post any info here on how you were able to get it working if you did!