Skip to content

Commit 9201f9f

Browse files
committed
Migrate Jest configuration to use a multi-project workspace setup
├── apps │ ├── browser │ │ ├── package.json │ │ └── tsconfig.json │ ├── editor │ │ ├── jest.config.js │ │ ├── package.json │ │ ├── src │ │ │ ├── commands │ │ │ │ └── apply-response-command │ │ │ │ └── utils │ │ │ │ └── response-parser │ │ │ │ ├── parsers │ │ │ │ │ ├── code-at-cursor-parser │ │ │ │ │ │ └── test │ │ │ │ │ │ └── code-at-cursor-parser.spec.ts │ │ │ │ │ ├── commit-message-parser │ │ │ │ │ │ └── test │ │ │ │ │ │ └── commit-message-parser.spec.ts │ │ │ │ │ ├── diff-parser │ │ │ │ │ │ └── test │ │ │ │ │ │ └── diff-parser.spec.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── patch-repair-parser │ │ │ │ │ └── test │ │ │ │ │ └── patch-repair-parser.spec.ts │ │ │ │ └── response-parser.ts │ │ │ └── utils │ │ │ └── normalize-path.ts │ │ └── tsconfig.json │ └── web │ ├── package.json │ └── tsconfig.json ├── jest.config.js ├── package.json ├── packages │ ├── shared │ │ ├── package.json │ │ └── tsconfig.json │ └── ui │ ├── package.json │ └── tsconfig.json └── tsconfig.json
1 parent 0aed9f0 commit 9201f9f

2 files changed

Lines changed: 40 additions & 17 deletions

File tree

‎apps/editor/jest.config.js‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
module.exports = {
3-
...require('../../jest.config.js'),
4-
rootDir: '../../',
5-
testMatch: [
6-
'<rootDir>/apps/editor/**/*.spec.ts?(x)'
7-
]
3+
displayName: 'editor',
4+
preset: 'ts-jest',
5+
testEnvironment: 'node',
6+
clearMocks: true,
7+
testMatch: ['<rootDir>/src/**/*.spec.ts?(x)'],
8+
testPathIgnorePatterns: ['/node_modules/', '/out/', '/dist/'],
9+
moduleNameMapper: {
10+
'^@shared/(.*)$': '<rootDir>/../../packages/shared/src/$1',
11+
'^@/(.*)$': '<rootDir>/src/$1'
12+
},
13+
transform: {
14+
'^.+\\.tsx?$': [
15+
'ts-jest',
16+
{
17+
tsconfig: '<rootDir>/tsconfig.json'
18+
}
19+
]
20+
}
821
}

‎jest.config.js‎

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
module.exports = {
3-
preset: 'ts-jest',
4-
testEnvironment: 'node',
5-
clearMocks: true,
6-
testMatch: [
7-
'<rootDir>/apps/**/*.spec.ts?(x)',
8-
'<rootDir>/packages/**/*.spec.ts?(x)'
9-
],
10-
testPathIgnorePatterns: ['/node_modules/', '/out/', '/dist/'],
11-
moduleNameMapper: {
12-
'^@shared/(.*)$': '<rootDir>/packages/shared/src/$1',
13-
'^@/(.*)$': '<rootDir>/apps/editor/src/$1'
14-
}
3+
projects: [
4+
'<rootDir>/apps/editor',
5+
{
6+
displayName: 'other',
7+
preset: 'ts-jest',
8+
testEnvironment: 'node',
9+
clearMocks: true,
10+
testMatch: [
11+
'<rootDir>/apps/**/*.spec.ts?(x)',
12+
'<rootDir>/packages/**/*.spec.ts?(x)'
13+
],
14+
testPathIgnorePatterns: [
15+
'/node_modules/',
16+
'/out/',
17+
'/dist/',
18+
'<rootDir>/apps/editor/'
19+
],
20+
moduleNameMapper: {
21+
'^@shared/(.*)$': '<rootDir>/packages/shared/src/$1'
22+
}
23+
}
24+
]
1525
}

0 commit comments

Comments
 (0)