Git Product home page Git Product logo

Comments (12)

fernandopasik avatar fernandopasik commented on May 25, 2024 2

Yes, after doing the yarn eject it will be there.

OK, I tried again with create-react-app

I did two things.

1 - Added the ignore in package.json jest config

"transformIgnorePatterns": [
      "[/\\\\]node_modules[/\\\\](?!react-children-utilities).+\\.(js|jsx|ts|tsx)$",
      "^.+\\.module\\.(css|sass|scss)$"
],

2 - Created a babel.config.js in the root folder with the content

module.exports = {
  presets: ["react-app"]
};

Those two steps made the tests pass

from react-children-utilities.

deepakjha14 avatar deepakjha14 commented on May 25, 2024 2

This issues still persist, i have run into this problem and spent couple of days already in search of the answer. I have i guess tried all the possible options given on this page and other github pages, no luck :(.

from react-children-utilities.

fernandopasik avatar fernandopasik commented on May 25, 2024 1

This issue would happen to any library you include that is published with ES Modules.
Did you try to what's described in jestjs/jest#6229 (comment) ?

In your jest.config.js try

"transformIgnorePatterns": [
  "/node_modules/(?!react-children-utilities)"
]

from react-children-utilities.

matthew-dean avatar matthew-dean commented on May 25, 2024 1

This issue persists with PNPM. It's important to know for library authors that ESM modules are still marked as experimentally supported in VM modules, which is required for Jest. I think there's a conception that Node.js can do ESM now and it's actually not there yet.

from react-children-utilities.

fernandopasik avatar fernandopasik commented on May 25, 2024

The other suggestion was to rename .babelrc in your project to babel.config.js

from react-children-utilities.

fernandopasik avatar fernandopasik commented on May 25, 2024

You should try to do both things.

from react-children-utilities.

deleemillie avatar deleemillie commented on May 25, 2024

The other suggestion was to rename .babelrc in your project to babel.config.js

I have tried all of the suggestions in jestjs/jest#6229, none of them work for this particular library. Further, my original project actually uses a babel.config.js and has never used a .babelrc and still does not work for this particular library.

from react-children-utilities.

fernandopasik avatar fernandopasik commented on May 25, 2024

I reproduced the behavior you mentioned but after using babel.config.js and at the same time adding the transformIgnorePatterns option in jest.config.js it worked.

Do you have babel-jest in your devDependencies ?

from react-children-utilities.

fernandopasik avatar fernandopasik commented on May 25, 2024

If this issue persists let me know

from react-children-utilities.

MaffooBristol avatar MaffooBristol commented on May 25, 2024

I'm also having this problem. My jest and babel configs are in the package.json file.

I've recently made a module that uses rollup and the settings from here:
https://github.com/rollup/rollup-starter-lib/blob/babel/rollup.config.js
and here
https://github.com/rollup/rollup-starter-lib/blob/babel/package.json

Is the issue that this module isn't doing all three of cjs, esm and umd?

from react-children-utilities.

deepakjha14 avatar deepakjha14 commented on May 25, 2024

@MaffooBristol I finally stumbled upon writing the transformIgnorePatterns in the package.json file. Surprisingly I was unable to run the same flag inside my jest.config.json however when i defined it inside my package.json it worked. Be mindful of your regex pattern,

from react-children-utilities.

minlare avatar minlare commented on May 25, 2024

Using pnpm I had to change the transformIgnorePatterns to the correct path node_modules/.pnpm:

transformIgnorePatterns: ['/node_modules/.pnpm/(?!react-children-utilities)']

https://stackoverflow.com/a/76555395/3684315

from react-children-utilities.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.