Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #10720
Closes #10721
There are 4 key changes here:
1. Remove chai-string
Chai-string is not compatible with chai 5
I did consider submitting a PR upstream, but the last commit to https://github.com/onechiporenko/chai-string was 5 years ago, it has no working CI build and the most recent node version the package was tested against is node 10. As such, I think there is quite a high risk this package is abandoned and my PR will be ignored.
Given we only use chai-string assertions in a handful of places, I have just opted to rewrite those few tests to use native chai and javascript so we can remove the plugin completely.
2. Upgrade chai and sinon-chai
These 2 packages need upgrading together to ensure due to peer dependency constraints.
3. Update chai imports
One of the breaking changes in Chai 5.0.0 (see https://github.com/chaijs/chai/releases/tag/v5.0.0 ) is
This means we needed to update any places where we are just doing
import chai from 'chai'
4. Migrate badge-maker tests to ESM
Most of the shields codebase is written in ESM. The badge-maker package is still CommonJS. We might at some point want to migrate the package to ESM anyway but I don't think we should be forced into that by a testing package. Lets consider that decision on its own merits. I have kept the package as CJS for now but migrated just the 3 test modules that use Chai to ESM by using the
.mjs
extension.