Skip to content

Commit

Permalink
hack: to use vite meta.env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
bajajcodes committed Dec 15, 2023
1 parent a66737b commit d28c0a2
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions frontend/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,29 @@ export default {
preset: 'ts-jest',
testEnvironment: 'jsdom',
transform: {
'^.+\\.tsx?$': 'ts-jest',
// process `*.tsx` files with `ts-jest`
'^.+\\.tsx?$': [
'ts-jest',
{
diagnostics: {
ignoreCodes: [1343],
},
astTransformers: {
before: [
{
path: 'node_modules/ts-jest-mock-import-meta',
options: {
metaObjectReplacement: {
env: {
// Replicate as .env.local
VITE_API_PATH: 'http://localhost:5000',
},
},
},
},
],
},
},
],
},
moduleNameMapper: {
// mocking assests and styling
Expand Down

0 comments on commit d28c0a2

Please sign in to comment.