error: Expression expected
See original GitHub issueWe are currently upgrading to NextJS 12, which is using SWC rather than babel.
I wanted to give @swc/jest a try because of ESM module issues with babel-jest:
SyntaxError: Cannot use import statement outside a module
After switching from
'^.+\\.(js|jsx|ts|tsx)$': '<rootDir>/node_modules/babel-jest'
to
'^.+\\.(t|j)sx?$': '@swc/jest'
I am getting the following errors:
FAIL stories/stories.test.js
● Test suite failed to run
error: Expression expected
|
36 | <RouterContext.Provider value={mockRouter}>
| ^
error: Expected ',', got 'value'
|
36 | <RouterContext.Provider value={mockRouter}>
| ^^^^^
Caused by:
0: failed to process js file
1: Syntax Error
Is @swc/jest not supposed to work with jsx/tsx files? The regrex implies that it does work with it. Any suggestions?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
android - Error:Expression expected - Stack Overflow
Error:Expression expected · 1. Change danielIntent. · 1. You can't use reserved keyword as an arguments. · 2. Sorry, it sounds bad and...
Read more >Expression expected Error in TypeScript | bobbyhadz
The "Expression expected" TypeScript error occurs when we have a syntax error in our code or our code editor is using an older...
Read more >Expression expected - Visual Basic - Microsoft Learn
An operator such as + or = requires an expression for its right operand, but no recognizable expression appears. Error ID: BC30201 ......
Read more >Groovy syntax error "expression expected" : IDEA-196296
Using a Spock spec with a newline after == fails with "expected expression" (tested with Groovy 3.4.15 and Spock 1.1-groovy-2.4).
Read more >Do you know why it appears "expression expected" error?
Do you know why it appears "expression expected" error? Do you know why appears an error "expression expected" in the code below? Copy...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Currently porting a test suite and had this issue. I had to set
jsx/tsxtotrueto resolve this issueI think https://github.com/swc-project/jest/pull/44 cause the issue?