From 09d743c6031ed658db42000163809ef6eb91fdf3 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sat, 15 Nov 2025 01:04:41 +0100 Subject: [PATCH] Fix --- backend/api/jest.config.js | 2 +- backend/api/package.json | 3 ++- backend/api/tsconfig.test.json | 5 ++++- backend/email/jest.config.js | 2 +- backend/email/tsconfig.test.json | 17 +++++++++++++++++ backend/shared/jest.config.js | 2 +- backend/shared/tsconfig.test.json | 17 +++++++++++++++++ jest.config.js | 7 +++++++ web/jest.config.js | 2 +- web/tsconfig.test.json | 14 ++++++++++++++ 10 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 backend/email/tsconfig.test.json create mode 100644 backend/shared/tsconfig.test.json create mode 100644 web/tsconfig.test.json diff --git a/backend/api/jest.config.js b/backend/api/jest.config.js index 26589e8b..02a37b30 100644 --- a/backend/api/jest.config.js +++ b/backend/api/jest.config.js @@ -20,7 +20,7 @@ module.exports = { globals: { 'ts-jest': { - tsconfig: '/tsconfig.json' + tsconfig: "/tsconfig.test.json" } }, diff --git a/backend/api/package.json b/backend/api/package.json index 6547486e..4aeb2635 100644 --- a/backend/api/package.json +++ b/backend/api/package.json @@ -21,7 +21,8 @@ "verify:dir": "npx eslint . --max-warnings 0", "regen-types": "cd ../supabase && make ENV=prod regen-types", "regen-types-dev": "cd ../supabase && make ENV=dev regen-types-dev", - "test": "jest --config jest.config.js" + "test": "jest --config jest.config.js", + "test:coverage": "jest --config jest.config.js --coverage" }, "engines": { "node": ">=20.0.0" diff --git a/backend/api/tsconfig.test.json b/backend/api/tsconfig.test.json index 7c7a7dc6..58048e7b 100644 --- a/backend/api/tsconfig.test.json +++ b/backend/api/tsconfig.test.json @@ -1,7 +1,10 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "rootDir": ".", + // Use / as the root for tests so path-mapped imports from + // ../shared and ../../common are within the configured rootDir. + // This avoids TS6059 during ts-jest compilation. + "rootDir": "../..", "baseUrl": ".", "paths": { "api/*": ["src/*"], diff --git a/backend/email/jest.config.js b/backend/email/jest.config.js index 26589e8b..02a37b30 100644 --- a/backend/email/jest.config.js +++ b/backend/email/jest.config.js @@ -20,7 +20,7 @@ module.exports = { globals: { 'ts-jest': { - tsconfig: '/tsconfig.json' + tsconfig: "/tsconfig.test.json" } }, diff --git a/backend/email/tsconfig.test.json b/backend/email/tsconfig.test.json new file mode 100644 index 00000000..58048e7b --- /dev/null +++ b/backend/email/tsconfig.test.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + // Use / as the root for tests so path-mapped imports from + // ../shared and ../../common are within the configured rootDir. + // This avoids TS6059 during ts-jest compilation. + "rootDir": "../..", + "baseUrl": ".", + "paths": { + "api/*": ["src/*"], + "shared/*": ["../shared/src/*"], + "common/*": ["../../common/src/*"], + "email/*": ["../email/emails/*"] + } + }, + "include": ["tests/**/*.ts", "src/**/*.ts"] +} diff --git a/backend/shared/jest.config.js b/backend/shared/jest.config.js index 26589e8b..02a37b30 100644 --- a/backend/shared/jest.config.js +++ b/backend/shared/jest.config.js @@ -20,7 +20,7 @@ module.exports = { globals: { 'ts-jest': { - tsconfig: '/tsconfig.json' + tsconfig: "/tsconfig.test.json" } }, diff --git a/backend/shared/tsconfig.test.json b/backend/shared/tsconfig.test.json new file mode 100644 index 00000000..58048e7b --- /dev/null +++ b/backend/shared/tsconfig.test.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + // Use / as the root for tests so path-mapped imports from + // ../shared and ../../common are within the configured rootDir. + // This avoids TS6059 during ts-jest compilation. + "rootDir": "../..", + "baseUrl": ".", + "paths": { + "api/*": ["src/*"], + "shared/*": ["../shared/src/*"], + "common/*": ["../../common/src/*"], + "email/*": ["../email/emails/*"] + } + }, + "include": ["tests/**/*.ts", "src/**/*.ts"] +} diff --git a/jest.config.js b/jest.config.js index 9b279a73..ed790410 100644 --- a/jest.config.js +++ b/jest.config.js @@ -13,4 +13,11 @@ module.exports = { // 'backend/api/src', // 'martin', ], + projects: [ + "/backend/api", + "/backend/shared", + "/backend/email", + "/common", + "/web" + ], }; diff --git a/web/jest.config.js b/web/jest.config.js index 26589e8b..02a37b30 100644 --- a/web/jest.config.js +++ b/web/jest.config.js @@ -20,7 +20,7 @@ module.exports = { globals: { 'ts-jest': { - tsconfig: '/tsconfig.json' + tsconfig: "/tsconfig.test.json" } }, diff --git a/web/tsconfig.test.json b/web/tsconfig.test.json new file mode 100644 index 00000000..6195e2dc --- /dev/null +++ b/web/tsconfig.test.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + // Use / as the root for tests so path-mapped imports from + // ../shared and ../../common are within the configured rootDir. + // This avoids TS6059 during ts-jest compilation. + "rootDir": "..", + "baseUrl": ".", + "paths": { + "common/*": ["../../common/src/*"], + } + }, + "include": ["tests/**/*.ts", "src/**/*.ts"] +}