diff --git a/jest.config.js b/jest.config.js index f3f7824c14..3caac38ef9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -24,9 +24,11 @@ const config = { // This resolve the path mappings from the tsconfig relative to each jest.config.js moduleNameMapper: Object.entries(paths || {}).reduce((acc, [path, [mapping]]) => { path = `^${path.replace(/\/\*$/, '/(.*)$')}`; - mapping = mapping.replace(/^\.\/(?:(.*)\/)?\*$/, '$1'); + mapping = mapping.replace(/^\.?\.\/(?:(.*)\/)?\*$/, '$1'); mapping = mapping ? `/${mapping}` : ''; - acc[path] = '' + (baseUrl ? `/${baseUrl.replace(/^\.\//, '')}` : '') + mapping + '/$1'; + acc[path] = mapping.startsWith('/test') + ? '' + mapping + '/$1' + : '' + (baseUrl ? `/${baseUrl.replace(/^\.\//, '')}` : '') + mapping + '/$1'; return acc; }, {}), setupFilesAfterEnv: ['jest-expect-message'], diff --git a/packages/cli/tsconfig.build.json b/packages/cli/tsconfig.build.json index 1e8a2ff7fa..55afe8b409 100644 --- a/packages/cli/tsconfig.build.json +++ b/packages/cli/tsconfig.build.json @@ -6,5 +6,5 @@ "tsBuildInfoFile": "dist/build.tsbuildinfo" }, "include": ["src/**/*.ts"], - "exclude": ["test/**"] + "exclude": ["test/**", "src/**/__tests__/**"] } diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 86b8d550e8..8c4325a55b 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -8,7 +8,9 @@ "baseUrl": "src", "paths": { "@/*": ["./*"], - "@db/*": ["./databases/*"] + "@db/*": ["./databases/*"], + "@test/*": ["../test/shared/*"], + "@test-integration/*": ["../test/integration/shared/*"] }, "tsBuildInfoFile": "dist/typecheck.tsbuildinfo", // TODO: remove all options below this line