Skip to content

Commit d6c53d2

Browse files
Merge pull request #2763 from oliverwebr/fix/swc-jest-example-code
docs(swc): change jest + swc example setup
2 parents 2428708 + d673ff9 commit d6c53d2

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

content/recipes/swc.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,34 @@ Once the installation is complete, update the `package.json`/`jest.config.js` fi
193193
{
194194
"jest": {
195195
"transform": {
196-
"^.+\\.(t|j)s?$": "@swc/jest"
196+
"^.+\\.(t|j)s?$": ["@swc/jest"]
197197
}
198198
}
199199
}
200200
```
201201

202+
Additionally you would need to add the following `transform` properties to your `.swcrc` file: `legacyDecorator`, `decoratorMetadata`:
203+
204+
```json
205+
{
206+
"$schema": "https://json.schemastore.org/swcrc",
207+
"sourceMaps": true,
208+
"jsc": {
209+
"parser": {
210+
"syntax": "typescript",
211+
"decorators": true,
212+
"dynamicImport": true
213+
},
214+
"transform": {
215+
"legacyDecorator": true,
216+
"decoratorMetadata": true
217+
},
218+
"baseUrl": "./"
219+
},
220+
"minify": false
221+
}
222+
```
223+
202224
If you use NestJS CLI Plugins in your project, you'll have to run `PluginMetadataGenerator` manually. Navigate to [this section](/recipes/swc#monorepo-and-cli-plugins) to learn more.
203225

204226
### Vitest

0 commit comments

Comments
 (0)