Top "Babel-jest" questions

A Babel transpiler to assist with the conversion of ES6 to ES5 for the Jest testing framework.

Mocking globals in Jest

Is there any way in Jest to mock global objects, such as navigator, or Image*? I've pretty much given up …

javascript unit-testing dependencies jestjs babel-jest
Mocking `document` in jest

I'm trying to write tests for my web components projects in jest. I already use babel with es2015 preset. I'm …

jestjs jsdom babel-jest
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
Unexpected token 'import' error while running Jest tests?

I realize this question has been asked several times but all of the solutions I've come across don't seem to …

vue.js configuration jestjs babel-jest
Does Jest support ES6 import/export?

If I use import/export from ES6 then all my Jest tests fail with error: Unexpected reserved word I convert …

ecmascript-6 jestjs babel-jest
`regeneratorRuntime` is not defined when running Jest test

The title pretty much explains what I'm facing. I'm trying to test a React component that has some state, and …

reactjs babeljs jestjs babel-polyfill babel-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: Cannot assign to read only property 'x' of object '#<Object>' React/JEST

While I am writing test case for my react component I am getting TypeError: Cannot assign to read only property …

reactjs jestjs enzyme babel-jest
babel@7 and jest configuration

Maybe you may help me? I try to configure jest to use babel@7 So I have: "jest": "^23.4.1", "@babel/core": "^7.0.0-beta.54", "…

babeljs jestjs babel-jest babel-core
React JS Jest causing "SyntaxError: Unexpected token ."

I am now using react JEST to test code. If a component is single, and not importing anything else, "npm …

reactjs jestjs babel-jest