1

Has anyone encountered this kind of an error? We had a bunch of jest js files that were working a few months but now are failing. Can any JEST experts help?

1
  • 1
    This is probably due to the fact that you upgrade the @lwc/jest-preset to the latest version without upgrading to Jest 25.
    – pmdartus
    Jun 2 '20 at 13:40
2

This was an unfortunate mismatch between dependencies of dependencies when using the base LWC Jest testing packages. More specifically, if you happen to get a babel-preset-jest version < 25.5.4 but are running jest version >= 25.5.4. The exact version of these dependencies probably depends on when you installed or upgraded your dependencies and what your package-lock.json or yarn.lock look like.

The fix is to upgrade all Jest related dependencies to be >= 25.5.4, or pin them all below. If you're using @salesforce/sfdx-lwc-jest to run your tests, this was fixed already in the prerelease branch.

This was fixed in the sfdx-lwc-jest project here: https://github.com/salesforce/sfdx-lwc-jest/pull/152

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.