Skip to content

Commit 3bb4cea

Browse files
committed
feat: adjust jest configs
1 parent db46828 commit 3bb4cea

File tree

7 files changed

+22
-8
lines changed

7 files changed

+22
-8
lines changed

angular.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"test": {
2828
"builder": "@angular-builders/jest:run",
2929
"options": {
30-
"tsConfig": "./tsconfig.spec.json"
30+
"configPath": "jest.config.js",
31+
"tsConfig": "tsconfig.spec.json"
3132
}
3233
}
3334
}
@@ -75,7 +76,8 @@
7576
"test": {
7677
"builder": "@angular-builders/jest:run",
7778
"options": {
78-
"tsConfig": "./tsconfig.spec.json"
79+
"configPath": "jest.config.js",
80+
"tsConfig": "tsconfig.spec.json"
7981
}
8082
},
8183
"lint": {

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"build:wc:dev": "ng build wc --configuration development && npm run build:wc:rename && npm run build:wc:copy",
1313
"build:watch": "mkdirp dist && nodemon --ignore dist --ignore dist-wc --ext js,yml,yaml,ts,html,css,scss,json,md --exec \"rimraf dist && npm run build:dev && cd dist && yalc publish --push --sig\"",
1414
"watch": "npm run build --watch --configuration development",
15-
"test": "ng test"
15+
"test": "ng test",
16+
"test:lib": "ng test lib",
17+
"test:wc": "ng test wc"
1618
},
1719
"prettier": "@openmfp/config-prettier",
1820
"dependencies": {

projects/lib/jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ const path = require('path');
22

33
module.exports = {
44
displayName: 'lib',
5+
roots: [__dirname],
6+
testMatch: ['**/*.spec.ts'],
57
coverageDirectory: path.resolve(__dirname, '../../coverage/lib'),
6-
setupFilesAfterEnv: [`${__dirname}/jest.setup.ts`],
78
coverageThreshold: {
89
global: {
910
branches: 67,

projects/lib/jest.setup.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

projects/wc/_mocks_/ui5‑mock.ts renamed to projects/wc/_mocks_/ui5-mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Component } from '@angular/core';
2-
import { ButtonComponent } from '@ui5/webcomponents-ngx';
32

43
@Component({ selector: 'ui5-component', template: '', standalone: true })
54
export class MockComponent {}
@@ -30,3 +29,4 @@ jest.mock('@ui5/webcomponents-ngx', () => {
3029
ToolbarComponent: MockComponent,
3130
};
3231
});
32+

projects/wc/jest.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@ const path = require('path');
22

33
module.exports = {
44
displayName: 'wc',
5+
roots: [__dirname],
6+
testMatch: ['**/*.spec.ts'],
57
coverageDirectory: path.resolve(__dirname, '../../coverage/wc'),
6-
coveragePathIgnorePatterns: ['<rootDir>/projects/lib/src/'],
8+
collectCoverageFrom: [
9+
'!<rootDir>/projects/wc/**/*.spec.ts',
10+
],
11+
coveragePathIgnorePatterns: [
12+
'<rootDir>/projects/lib/',
13+
'<rootDir>/projects/wc/src/main.ts',
14+
'<rootDir>/projects/wc/src/app/app.config.ts',
15+
'<rootDir>/projects/wc/jest.config.js',
16+
],
717
setupFilesAfterEnv: [`${__dirname}/jest.setup.ts`],
818
modulePathIgnorePatterns: ['<rootDir>/projects/wc/_mocks_/'],
919
coverageThreshold: {

projects/wc/jest.setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
jest.requireMock('./_mocks_/ui5mock');
1+
jest.requireMock('./_mocks_/ui5-mock');

0 commit comments

Comments
 (0)