Skip to content

Commit 5f01d74

Browse files
committed
fix(cli): add Jest moduleNameMapper for workspace dependencies
- Add moduleNameMapper configuration in packages/cli/jest.config.js - Maps @launchql/* packages to packages/*/dist directories - Maps pg-env and pg-cache to their dist directories - Fixes Jest module resolution issues with pnpm's isolated structure - Update test snapshots to match corrected template build script format
1 parent a1334d8 commit 5f01d74

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

packages/cli/__tests__/__snapshots__/init.install.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ exports[`cmds:install - with initialized workspace and module installs a module
2525
"url": "https://github.com/undefined/undefined",
2626
},
2727
"scripts": {
28-
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
29-
"build:dev": "npm run clean; tsc --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
28+
"build": "npm run clean; tsc -p tsconfig.json; tsc -p tsconfig.esm.json; npm run copy",
29+
"build:dev": "npm run clean; tsc -p tsconfig.json --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
3030
"clean": "rimraf dist/**",
3131
"copy": "copyfiles -f ../../LICENSE README.md package.json dist",
3232
"lint": "eslint . --fix",
@@ -106,8 +106,8 @@ exports[`cmds:install - with initialized workspace and module installs two modul
106106
"url": "https://github.com/undefined/undefined",
107107
},
108108
"scripts": {
109-
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
110-
"build:dev": "npm run clean; tsc --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
109+
"build": "npm run clean; tsc -p tsconfig.json; tsc -p tsconfig.esm.json; npm run copy",
110+
"build:dev": "npm run clean; tsc -p tsconfig.json --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
111111
"clean": "rimraf dist/**",
112112
"copy": "copyfiles -f ../../LICENSE README.md package.json dist",
113113
"lint": "eslint . --fix",

packages/cli/jest.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ module.exports = {
1414
transformIgnorePatterns: [`/node_modules/*`],
1515
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
1616
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
17-
modulePathIgnorePatterns: ['dist/*']
17+
modulePathIgnorePatterns: ['dist/*'],
18+
moduleNameMapper: {
19+
'^@launchql/logger$': '<rootDir>/../../packages/logger/dist',
20+
'^@launchql/(.*)$': '<rootDir>/../../packages/$1/dist',
21+
'^pg-env$': '<rootDir>/../../packages/pg-env/dist',
22+
'^pg-cache$': '<rootDir>/../../packages/pg-cache/dist',
23+
},
1824
};

0 commit comments

Comments
 (0)