Skip to content

switch to mocha for testing #340

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

Merged
merged 13 commits into from
Dec 2, 2023
Merged

switch to mocha for testing #340

merged 13 commits into from
Dec 2, 2023

Conversation

davidjgoss
Copy link
Contributor

@davidjgoss davidjgoss commented Dec 2, 2023

🤔 What's changed?

Remove Jest, and switch to a combination of Mocha, Chai and Sinon for testing, assertions and mocking respectively. React Testing Library is retained and works as before. Most of the diff is just changing the assertions to the Chai API, and some configuration.

For SCSS files, which used to be pretty much handled by Jest's module type mappings, I found the best compromise was to implement a small CSS loader (css-loader.mjs) to resolve to an object with keys for each class name found in the file.

Also pins to the latest 18.x Node.js version that supports register for module loaders, and ensures we use the current LTS for release jobs.

⚡️ What's your motivation?

In #338 we just about got Jest working with ESM, but it's super fragile - bringing in new dependencies for #337 immediately threw up some obscure errors.

Jest is also slow compared to Mocha, at least for our test suite.

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, documentation etc. without changing behaviour)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

Copy link

netlify bot commented Dec 2, 2023

Deploy Preview for cucumber-react-components failed.

Name Link
🔨 Latest commit db4926f
🔍 Latest deploy log https://app.netlify.com/sites/cucumber-react-components/deploys/656af7ddd81cbf000883fd73

@davidjgoss davidjgoss marked this pull request as ready for review December 2, 2023 09:25
@davidjgoss davidjgoss merged commit abdc29b into main Dec 2, 2023
@davidjgoss davidjgoss deleted the fix/switch-to-mocha branch December 2, 2023 09:25
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

Successfully merging this pull request may close these issues.

1 participant