Comments (1)
Do I need to set up a .swcrc file?
Yes - that or inline it like the README implicitly suggests: https://github.com/swc-project/jest#usage
module.exports = {
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest', { ...config, /* custom configuration in Jest */ }], //.swcrc contents go here in place of `config`
},
}
I am also here because of the recent ts-jest
issues kulshekhar/ts-jest#1967 (Granted it could be Jest
it could be v8
. Ultimately - I just wanted to move to SWC to get faster, more stable, and ultimately most performant tests I can run).
I am trying to use this package with a React Native app - and am running into issues after I resolve the one listed here. I resolved this issue you've outlined by adding an .swcrc
. I have tried a couple of different .swcrc
configurations:
And just a basic one from the example in the repo here:
jest/examples/react/package.json
Lines 33 to 51 in 4660359
The above works without a physical .swcrc
file - which is what I'll opt for since our App wont be built using SWC yet (or maybe ever 🤷 Depends on the RN support in the future.)
The issue I'm running into now - is very similar:
FAIL MyApp/x/y/z.spec.tsx
● Test suite failed to run
error: Expected ',', got ':'
|
51 | applyWithGuard<TArgs: $ReadOnlyArray<mixed>, TOut>(
| ^
Caused by:
0: failed to process js file
1: Syntax Error
at Compiler.transformSync (node_modules/@swc/core/index.js:137:25)
at transformSync (node_modules/@swc/core/index.js:217:21)
at Object.process (node_modules/@swc/jest/index.js:55:45)
at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:612:31)
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:758:40)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:815:19)
I haven't had any luck getting past this point and would LOVE some help troubleshooting how to move forward.
EDIT: I'll make a separate issue so this question doesn't muddy up your question. Hope this answer helped though. #85
from jest.
Related Issues (20)
- semicolon bug with nestjs
- jest works fine, but with the coverage flag many tests fail HOT 1
- /* istanbul ignore next */ not working HOT 3
- Jest: clone is not a function HOT 3
- follow on swc/jest with plugins HOT 4
- Module @swc/jest should have "jest-preset.js" or "jest-preset.json" file at the root. HOT 1
- ReferenceError: setImmediate is not defined HOT 1
- "SyntaxError: Unexpected identifier" for AsyncDisposable HOT 5
- env and jest.target cannot be used at same time HOT 1
- CustomEvent thrown `TypeError` is not an instance of `TypeError` HOT 4
- Cannot find module error after upgrading `@swc/core` HOT 1
- `@swc/jest` is has nothing to do with `/node_modules/` problem HOT 4
- transform automatic for react not working inside yarn workspace
- Is there a docs for usage in react native ?
- The coverage percent of babel-jest and @swc/jest are different HOT 2
- ReferenceError: React is not defined with tsx HOT 1
- swc/jest fails tests with certain functions imported by namespace imports
- Compile typescript from child_process fork does not work (dynamic import) HOT 1
- rust file not found error
- jest.mock is not working if import something from "@jest/globals"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest.