Git Product home page Git Product logo

Comments (2)

x86chi avatar x86chi commented on May 21, 2024 6

I solved it by insert the babel-config: true in jest config.

The difference is that the babel-jest do not specified directly as a transform, and keep the ts-jest preset.

"preset": "ts-jest",
  "globals": {
    "ts-jest": {
      "babelConfig": true
  }
},

from enzyme-adapter-preact-pure.

robertknight avatar robertknight commented on May 21, 2024

Hello,

First of all, your problem doesn't seem like it relates to this project directly. It seems like you're having trouble getting TypeScript + JSX to work inside Jest. I would recommend asking for help in Jest's community forums/chat as you're more likely to find the right experts.

From the error messages you posted, it seems like Jest is parsing a JavaScript file containing JSX expressions and it isn't set up to handle that. To me this suggests that either you need to configure TypeScript to output plain JavaScript (not JavaScript + JSX) or you need to use another tool to convert TypeScript's JavaScript + JSX output to plain JavaScript. I guess this is what you were trying to do with babel-jest? One possible issue I can see is that your regular expression (^.+\\.ts$) does not match files than end with .tsx.

I'm closing this issue because I don't think there is an issue with the adapter, but please do post a comment here when you figure the problem out.

from enzyme-adapter-preact-pure.

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.