babel-jest Questions
3
Solved
I'm setting up the tests for my web application, which works with the Vue framework with TypeScript, using the Jest framework. Everything seems to work alright, except with the @ symbol in my impor...
Helvellyn asked 2/7, 2020 at 8:18
9
Solved
I'm getting an error when trying to run my test file (I'm using react typescript)
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g....
Quartet asked 25/5, 2022 at 18:2
6
I have spent a long time looking at other questions about this and looking at other projects on Github but none of the answers seem to work for me.
I am loading a third party library in my project...
Kingsley asked 3/5, 2018 at 5:59
7
I have the following line that executes correctly in browser
eval(Babel.transform(template, { presets: ['react'] }).code);
but when I run jest tests I am getting ReferenceError: React is not defi...
Heliotype asked 21/11, 2019 at 17:51
6
I'm having the follow error when running my tests with jest.
console.error
Error: Could not parse CSS stylesheet
at exports.createStylesheet ([PERSONAL_PATH]/node_modules/jsdom/lib/jsdom/living/...
Corgi asked 9/11, 2021 at 23:3
3
Solved
This error is coming up when I am making a pull request. There is a GitHub workflow audit that runs checks on the pull request and it loads the test file from another repository.
- name: Run Audits...
Andersonandert asked 10/4, 2020 at 18:7
30
I have a React application (not using Create React App) built using TypeScript, Jest, Webpack, and Babel. When trying to run yarn jest, I get the following error:
I have tried removing all package...
Plantain asked 29/10, 2019 at 18:35
20
Solved
I couldn't get rid of this SyntaxError: Cannot use import statement outside a module error no matter what I have tried and it got so frustrating. Is there anybody out here solved this issue? I have...
Aberdare asked 13/5, 2020 at 17:41
1
I want to test some code which uses the newly added decorators in TypeScript 5.0 (not experimental decorators), how can I make Jest interpret that code?
I get SyntaxError: Invalid or unexpected tok...
Penury asked 29/4, 2023 at 15:0
4
Solved
I'm running into the following error when testing my application using jest:
FAIL
● Test suite failed to run
Cannot create styled-component for component: undefined.
30 |
31 |
> 32 | e...
Nomenclator asked 14/4, 2022 at 18:38
3
Solved
I'm working on a Ruby on Rails 7 app with a few JS web components written using lit element. I'm trying to add Jest to the project so we can unit test our web components.
Not using Typescript, just...
Adulation asked 24/2, 2023 at 23:23
10
Solved
I'm trying to write tests for my web components projects in jest. I already use babel with es2015 preset. I'm facing an issue while loading the js file. I have followed a piece of code where docume...
Hedgerow asked 12/12, 2016 at 9:47
5
Solved
I am working on a Next.js project using TypeScript and for testing I use Jest and React Testing Lib. However, I encounter a SyntaxError: Cannot use import statement outside a module for components ...
Altruist asked 30/1, 2022 at 16:45
13
Solved
If I use import/export from ES6 then all my Jest tests fail with error:
Unexpected reserved word
I convert my object under test to use old school IIFE syntax and suddenly my tests pass. Or, take ...
Promise asked 2/3, 2016 at 19:33
1
I'm trying to integrate Jest, (ts-jest) into my typescript project which uses styled-components/macros. But for some reason, Jest is complaining with the following error:
ts-jest[versions] (WARN) V...
Stroke asked 20/5, 2022 at 10:54
3
I am trying to run a test with Jest and I'm currently using jsx and tsx (changing from js to ts) in my react app but when I run my tests, all jsx tests are successful except those in tsx with optio...
Ithnan asked 28/2, 2021 at 0:0
4
Solved
I have a very simple test:
describe('sanity', () => {
it('sanity', () => {
expect(true).toBeTruthy()
})
})
And I'm receiving the following error:
FAIL spec/javascript/sanity_test.js
...
Punctuality asked 16/3, 2020 at 22:40
19
Every time I run jest it never runs anything. I have let the counter go arbitrarily high. I have run jest with --no-cache
jest --debug output is as follows:
{
"configs": [
{
"automock": fals...
Evelynneven asked 17/2, 2018 at 21:33
8
Solved
we were using jest from unit testing in react-native. It was working well.
We just deleted npm and installed it again and then when we tried to run unit test(npm test) we are getting following erro...
Purapurblind asked 9/3, 2017 at 10:16
4
Solved
i don't know why this is suddenly not working but this is my jest.config.js:
module.exports = {
preset: 'react-native',
verbose: true,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'n...
Anglesey asked 16/3, 2021 at 9:29
0
Issue
Unable to transpile external package exported in ESM syntax
Jest Version
29.5.0
Steps to reproduce
Clone my repo at https://github.com/paulwongx/turborepo-jest-issue
Install packages yarn wo...
Electrolyze asked 8/6, 2023 at 16:6
3
Solved
While I am writing test case for my react component I am getting
TypeError: Cannot assign to read only property 'x' of object '#'
wherein while the application run it does not throw similiar err...
Phonic asked 20/2, 2018 at 12:20
1
Several of my unit tests are failing to run with the following error:
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. i...
Agata asked 17/5, 2023 at 20:23
7
Solved
In my react native project, I have recently installed node module react-native-async-storage as I received warnings about the native package from 'react-native' being deprecated and moved out to an...
Nata asked 29/3, 2019 at 13:49
5
Solved
Relatively new to Vuejs and testing its components. Using vue-test-utils and jest for testing. Getting following error
test log
The .vue file consists of template, component and styling. Below is...
Fissionable asked 14/2, 2018 at 14:51
1 Next >
© 2022 - 2025 — McMap. All rights reserved.