Issue with TypeORM decorators when running vitest in TypeScript project #3320
-
I'm working with TypeORM and I noticed that my code is not working when I don't explicitly set the column type, for example @column({ type: 'varchar' }). I've already added "experimentalDecorators": true and "emitDecoratorMetadata": true to the tsconfig.json file and imported reflect-metadata at the entry point of the API, but the issue persists. Can anyone suggest what else I could be missing or any potential solutions to this problem? The typeorm entity:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Hey, @carlosmoliv. Install the following package: then, add this configuration to the vitest config file: import swc from 'unplugin-swc';
export default defineConfig({
test: {
// ... configs
},
// add the line below
plugins: [swc.vite()],
}); |
Beta Was this translation helpful? Give feedback.
Hey, @carlosmoliv. Install the following package:
unplugin-swc
then, add this configuration to the vitest config file: