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

Jest tests are not running after updating from 5.0.* to 5.1.7 #38

Open
petercmuc opened this issue Aug 2, 2023 · 1 comment
Open

Jest tests are not running after updating from 5.0.* to 5.1.7 #38

petercmuc opened this issue Aug 2, 2023 · 1 comment

Comments

@petercmuc
Copy link

We recently updated the „merge-anything“ dependency in our project from 5.0.2 to version 5.1.7 which changes how the exported files are treated. This is a breaking change...
The default export is now modules instead of commonjs (https://github.com/mesqueeb/merge-anything/blob/v5.1.7/package.json#L9). Unfortunately, Jest in combination with stencil does not support modules in test so far (ionic-team/stencil#3230). These two things together simply break the tests with a more or less helpful messages.

@danielcrisp
Copy link

danielcrisp commented Sep 6, 2023

@petercmuc I was able to workaround this by making Jest transform the module (via Babel). You can do that with transformIgnorePatterns

https://jestjs.io/docs/configuration#transformignorepatterns-arraystring

For example:

import type { Config } from 'jest';

const config: Config = {
  transformIgnorePatterns: [
    '/node_modules/(?!merge-anything|is-what)'
  ],
};

export default config;

(I had to include is-what too as it is used by merge-anything)

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

2 participants