chaijs / sinon-chai

Extends Chai with assertions for the Sinon.JS mocking framework.
Other
1.09k stars 108 forks source link

Chai v5 support #160

Open stephen-willoughby opened 8 months ago

stephen-willoughby commented 8 months ago

Now chai v5 is out, it would be helpful if sinon-chai could also support it

neverbot commented 7 months ago

@domenic I think the first pull request (#161) from @robinbisping solves this issue, could it be accepted? Thanks in advance!

dschweinbenz commented 6 months ago

push

ddolcimascolo commented 1 month ago

Hi,

So while adding support for chai@5 you dropped support for chai@4?

David

43081j commented 1 month ago

chai 5 is ESM-only, while chai 4 is commonjs

if you haven't had chance to move to ESM yet, you should stick to chai 4 (and the older sinon-chai version)

mixing them up leads to various problems since you can't (currently) require ESM modules in node. so it is one or the other

ddolcimascolo commented 1 month ago

Yeah. I'm too tired to once again explain that breaking the ecosystem is not cool. Thanks for maintaining open source projects, keep up the good work.

Cheers, David

crfrolik commented 1 month ago

Yeah. I'm too tired to once again explain that breaking the ecosystem is not cool. Thanks for maintaining open source projects, keep up the good work.

Cheers, David

That's why it was a major version bump, since it is a breaking change.

Realistically, supporting both ESM and commonjs is challenging. At best it's extra work. Since ESM is "the future" of JavaScript, it makes sense to move to that and ask commonjs folks to stick with chai 4 etc. until they are ready to migrate.

43081j commented 1 month ago

Indeed, nobody has "broken" the ecosystem here

If you don't have time to move to esm, use chai 4 until you do.

As per semver, chai 5 is a breaking change to switch to esm. The feature set is pretty much the same as 4.

If you still think the ecosystem is broken, it is important you explain yourself so we can investigate it.

s100 commented 1 month ago

For clarity I think it would be useful to document the fact that sinon-chai@4.0.0 drops support for Chai 4 in the change log for v4.0.0.

43081j commented 1 month ago

im not sure its so simple

sinon-chai 4.x should work fine with chai 4, assuming your project is written as ES modules