Skip to content

Cannot test with tsx syntax #403

Answered by zhaoyao91
zhaoyao91 asked this question in Q&A
Discussion options

You must be logged in to vote

well, all done.

first, install solid-jest: https://github.com/ryansolid/solid-jest

then, update jest.config.js

module.exports = {
  preset: "solid-jest/preset/browser",
};

then, update babel config

module.exports = {
  env: {
    test: {
      presets: [["@babel/preset-env"]],
    },
  },

  presets: [
    ["@babel/preset-env", { targets: "defaults", modules: false }],
    "@babel/preset-typescript",
    ["babel-preset-solid", { delegateEvents: false }],
  ],
  plugins: [
    "@babel/plugin-transform-runtime",
    "@babel/plugin-proposal-class-properties",
  ],
};

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by zhaoyao91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant