Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
Tests fail after adding TypeScript to React Project

I'm attempting to add typeScript to a React project that uses javascript. I changed one class and the functionality works the same but several jest tests failed to run and had this error

Cannot find module 'pathtoclass/updatedTSClass' from 'jsClas'.

this is how I import the functional component

import updatedTSClass from '../../../path/path/updatedTSClass';

here is my tsconfig

  "compilerOptions": {
    "jsx": "react",
    "lib": ["es2019", "dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "checkJs": false,
    "target": "esnext",
    "noEmit": true,
    "removeComments": true,
    "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
    "strict": true,
    "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
    "skipLibCheck": true,
    "sourceMap": true
  },
  "include": ["./src/**/*"],
  "exclude": ["./cypress/**/*", "./coverage/**/*", "node_modules"]
}

jest.config.js

module.exports = {
    modulePaths: [
    "<rootDir>"
  ],

  globals: {
    "ts-jest": {
      "tsConfigFile": "tsconfig.json",
      "enableTsDiagnostics": true
    }
  },

  preset: 'ts-jest',
  transform: {
    '^.+\\.(ts|tsx)?$': 'ts-jest',
    "^.+\\.(js|jsx)$": "babel-jest",
  },
}

.babelrc

{
  "presets": ["@babel/preset-react", "@babel/preset-env", "@babel/preset-typescript"],
  "plugins": ["react-hot-loader/babel", "@babel/plugin-proposal-class-properties"]
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!