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

Fix for breaking change in Jest V28. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

farwinit
Copy link

Jest V28 has a breaking change, requiring the process function to return an object, rather than a string. This pull request fixes that, however it will probably break for earlier Jest versions. I had a look at the Jest docs, but couldn't spot any way to see which Jest version is running.

This was referenced Oct 24, 2022
@gabgagnon
Copy link

gabgagnon commented Oct 26, 2022

Hello there, can we merge this branch and create a new release on npm? 😄

Big thanks for the fix

@KorySchneider
Copy link

Running into this issue as well after upgrading to Jest 28. @half-halt please release a new version with this change.

@sonic1981
Copy link

Can this PLEASE be released?

@jongrubb
Copy link

jongrubb commented Feb 28, 2023

In the meantime, you can write a tranformer wrapper like...

// in <rootDir>/jestSvgTransformerWrapper.js
const svgJest = require('svg-jest');

module.exports = {
  process(...args) {
    return {
      code: svgJest.process(...args)
    };
  }
};

then in your jest.config, define the transformer like...

 '\\.svg$': '<rootDir>/jestSvgTransformWrapper.js',

@leobastiani
Copy link

Just mentioning I did

yarn add -D svg-jest@farwinit/svg-jest#support_jest_v28

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.

7 participants