Top "Ts-jest" questions

How to resolve "Cannot use import statement outside a module" in jest

I have a React application (not using Create React App) built using TypeScript, Jest, Webpack, and Babel. When trying to …

reactjs jestjs babeljs babel-jest ts-jest
Cannot find name 'it' in Jest TypeScript

I try to create an intial setup for Jest in React + TypeScript. I have completed the initial setup and try …

typescript npm jestjs ts-jest
Jest won't transform the module - SyntaxError: Cannot use import statement outside a module

I couldn't get rid of this SyntaxError: Cannot use import statement outside a module error no matter what I have …

typescript jestjs babel-jest ts-jest
TypeError: Jest: a transform must export a `process` function

Recently upgrading my app to Angular 11. Jest has been set up as the default testing framework. Running npm test results …

angular jestjs ts-jest angular11
Jest test passed but get Error: connect ECONNREFUSED 127.0.0.1:80 at the end

I'm using node with TypeScript on my back end and jest and supertest as my test framework on my back …

node.js testing jestjs ts-jest
How to check if a method is called in nested jest mock functions

I have a mock service like below const firebaseService = jest.fn(() => ({ initializeApp: jest.fn(() => { /*do nothing*/}), })) in my …

javascript jestjs ts-jest
How to use jest.spyOn with React function component using Typescript

I am developing a React app using Typescript, and hooks, and I am trying to use Enzyme with Jest to …

reactjs typescript jestjs enzyme ts-jest
React Jest test fails to run with ts-jest - Unexpected token on imported file

I have a test for a test for a TSX file written in a JSX file which fails to run …

reactjs jestjs babel-jest ts-jest