Skip to content

Commit 243cbde

Browse files
committed
chore: fix up test configs
1 parent 1e863ee commit 243cbde

File tree

12 files changed

+166
-19
lines changed

12 files changed

+166
-19
lines changed

angular.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"test": {
2828
"builder": "@angular-devkit/build-angular:jest",
2929
"options": {
30+
"exclude": [
31+
"**/schematics/ng-add/*.spec.ts"
32+
],
3033
"tsConfig": "projects/angular-redux/tsconfig.spec.json",
3134
"polyfills": [
3235
"zone.js",

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"start": "ng serve",
77
"build": "ng build",
88
"watch": "ng build --watch --configuration development",
9-
"test": "ng test"
9+
"test": "yarn test:ng && yarn test:schematics",
10+
"test:ng": "ng test",
11+
"test:schematics": "cd projects/angular-redux/schematics && jest"
1012
},
1113
"workspaces": {
1214
"packages": [
@@ -44,6 +46,7 @@
4446
"jest": "^29.7.0",
4547
"jest-environment-jsdom": "^29.7.0",
4648
"ng-packagr": "^18.2.0",
49+
"ts-jest": "^29.2.5",
4750
"typescript": "~5.5.2"
4851
},
4952
"packageManager": "yarn@4.1.0"

projects/angular-redux/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"peerDependencies": {
1414
"@angular/common": ">=17.3.0",
1515
"@angular/core": ">=17.3.0",
16-
"redux": "^5.0.0",
17-
"@reduxjs/toolkit": "^2.2.7"
16+
"@reduxjs/toolkit": "^2.2.7",
17+
"redux": "^5.0.0"
1818
},
1919
"peerDependenciesMeta": {
20-
"redux": {
20+
"@reduxjs/toolkit": {
2121
"optional": true
2222
},
23-
"@reduxjs/toolkit": {
23+
"redux": {
2424
"optional": true
2525
}
2626
},

projects/angular-redux/schematics-core/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ export const stringUtils = {
6969
pluralize,
7070
};
7171

72-
export { updatePackage } from './utility/update';
73-
7472
export { parseName } from './utility/parse-name';
7573

7674
export { addPackageToPackageJson } from './utility/package';

projects/angular-redux/schematics-core/utility/project.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { TargetDefinition } from '@angular-devkit/core/src/workspace';
1+
// import { TargetDefinition } from '@angular-devkit/core/src/workspace';
22
import { getWorkspace } from './config';
33
import { SchematicsException, Tree } from '@angular-devkit/schematics';
44

55
export interface WorkspaceProject {
66
root: string;
77
projectType: string;
88
architect: {
9-
[key: string]: TargetDefinition;
9+
// [key: string]: TargetDefinition;
10+
[key: string]: any;
1011
};
1112
}
1213

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default {
2+
displayName: 'Schematics',
3+
coverageDirectory: '../../coverage/modules/schematics',
4+
transform: {
5+
'^.+\\.(ts|mjs|js)$': [
6+
'ts-jest',
7+
{
8+
tsconfig: '<rootDir>/tsconfig.spec.json'
9+
},
10+
],
11+
},
12+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)']
13+
};

projects/angular-redux/schematics/ng-add/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as fs from "fs";
22
import * as path from "path";
3-
import { fileURLToPath } from 'url';
43
import * as ts from 'typescript';
54
import {
65
Rule,
@@ -95,10 +94,7 @@ function addImportToNgModule(options: AngularReduxOptions): Rule {
9594
};
9695
}
9796

98-
const __filename = fileURLToPath(import.meta.url);
99-
const __dirname = path.dirname(__filename);
100-
101-
const angularReduxPackageMeta = fs.readFile(path.resolve(__dirname, '../../package.json')) as {
97+
const angularReduxPackageMeta = fs.readFileSync(path.resolve(__dirname, '../../package.json')) as unknown as {
10298
version: string;
10399
peerDependencies: {
104100
[key: string]: string;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "../../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../out-tsc/spec",
5+
"emitDecoratorMetadata": true,
6+
"types": [
7+
"jest",
8+
"node"
9+
]
10+
},
11+
"include": [
12+
"**/*.spec.ts",
13+
"**/*.d.ts"
14+
]
15+
}

0 commit comments

Comments
 (0)