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

Chai v5 support #281

Closed
meyfa opened this issue Dec 29, 2023 · 13 comments
Closed

Chai v5 support #281

meyfa opened this issue Dec 29, 2023 · 13 comments

Comments

@meyfa
Copy link

meyfa commented Dec 29, 2023

The current peerDependencies version range forbids installing chai-as-promised with chai v5:

"peerDependencies": {
    "chai": ">= 2.1.2 < 5"
  }

Release notes: https://github.com/chaijs/chai/releases/tag/v5.0.0

@Stwissel
Copy link

Stwissel commented Jan 1, 2024

I have the problem too. @domenic -> if you have no bandwidth to maintain, let's talk

@BryanHuntNV
Copy link

Also note that chai.use() doesn't currently work without a code change: chaijs/chai#1569

@MirzaMBaig
Copy link

node version - v16.19.1
npm version - 8.19.3

when updated the package dependencies for chai to 5.0.0 its not longer working.

npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/chai
npm WARN   dev chai@"^5.0.0" from the root project
npm WARN   1 more (chai-as-promised)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer chai@">= 2.1.2 < 5" from [email protected]
npm WARN node_modules/chai-as-promised
npm WARN   dev chai-as-promised@"^7.1.1" from the root project

@BryanHuntNV
Copy link

See also: chaijs/chai#1570

@khteh
Copy link

khteh commented Jan 6, 2024

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/chai
npm ERR!   dev chai@"^5.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer chai@">= 2.1.2 < 5" from [email protected]
npm ERR! node_modules/chai-as-promised
npm ERR!   dev chai-as-promised@"^7.1.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /home/khteh/.npm/_logs/2024-01-06T09_00_12_017Z-eresolve-report.txt

@mcm1957
Copy link

mcm1957 commented Jan 6, 2024

Hope you noticed that the last commit at this repository is 6 years ago.
I would not expect a fast fix...

@khteh
Copy link

khteh commented Jan 8, 2024

Is there any alternative to this library?

@mcm1957
Copy link

mcm1957 commented Jan 8, 2024

Is there any alternative to this library?

chaijs/chai#1570

@rvagg
Copy link

rvagg commented Jan 10, 2024

I got desperate enough to fork and fix, https://github.com/rvagg/chai-as-promised, @rvagg/chai-as-promised is ESM, bundles the @types/chai-as-promised types, and works with chai@5. Can upstream some of those commits here if Domenic decides this isn't a dead project.

@euberdeveloper
Copy link

I got desperate enough to fork and fix, https://github.com/rvagg/chai-as-promised, @rvagg/chai-as-promised is ESM, bundles the @types/chai-as-promised types, and works with chai@5. Can upstream some of those commits here if Domenic decides this isn't a dead project.

Just in time

@KaiSchwarz-cnic
Copy link

KaiSchwarz-cnic commented Jan 17, 2024

As long as there are no breaking changes somewhere, you can simply add chai to package.json's overrides section e.g.:

...
  "overrides": {
    "chai": "^5.0.0"
  },
...

This approach is giving us often a bit time for either finding a maintained replacement or forking + maintaining on our own or for entirely cleaning up an unmaintained dependency. More freedom temporarily ...
Dependency Installation via npm worked for me based on that approach at least. Tests fail, but that is eventually not related.

Finally and just for reference, I had to migrate our tests to:

import { expect, use } from 'chai';
import chaiPromised from "chai-as-promised";
use(chaiPromised);

...

Hope this helps. Worked like a charm.

@ramanarupa
Copy link

https://github.com/ramanarupa/chai-promised

@43081j
Copy link
Contributor

43081j commented May 13, 2024

FYI 7.1.2 resolves the peer dependency issue

8.0.0 is on the way and will be esm-only like chai itself

closing since the 7.1.2 release should solve this issue for now.

@43081j 43081j closed this as completed May 13, 2024
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

No branches or pull requests

12 participants