sodatea / vite-jest

First-class Vite integration for Jest
MIT License
401 stars 51 forks source link

Fixed react ts jest #16

Closed jamesg1 closed 2 years ago

jamesg1 commented 2 years ago

Related to https://github.com/sodatea/vite-jest/issues/12 and https://github.com/vitejs/vite/issues/1955

I changed "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}", to "<rootDir>/src/**/*.{spec,test}.{ts,tsx}", and now the tests are running.

Screen Shot 2021-07-30 at 10 55 42 AM

module.exports = {
  preset: "vite-jest",

  setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
  testMatch: [
    "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
    "<rootDir>/src/**/*.{spec,test}.{ts,tsx}",
  ],
  testEnvironment: "jest-environment-jsdom",
  moduleNameMapper: {
    "\\.(css|sass|scss)$": "identity-obj-proxy",
  },
};
msakrejda commented 2 years ago

Is this still relevant? The test passes me on a fresh checkout.

jamesg1 commented 2 years ago

Yeah can be closed. I believe there is another vite jest library under development too.