Skip to content

Instantly share code, notes, and snippets.

@marcelo-ribeiro
Created March 16, 2022 04:03
Show Gist options
  • Save marcelo-ribeiro/0fabdbbb53cbd61b88f959a276d81329 to your computer and use it in GitHub Desktop.
Save marcelo-ribeiro/0fabdbbb53cbd61b88f959a276d81329 to your computer and use it in GitHub Desktop.
Config Jest on ViteJS — Just edit transform property. Source: https://www.youtube.com/watch?v=edXudaVB0Bg&ab_channel=Rocketseat
...
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: true,
},
keepClassNames: true,
transform: {
legacyDecorator: true,
decoratorMetadata: true,
react: {
runtime: 'automatic',
},
},
},
module: {
type: 'es6',
noInterop: false,
},
},
],
},
...
npm i -D jest @types/jest ts-node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment