Skip to content

Commit

Permalink
build: update nx to v17
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus-Ende committed Apr 9, 2024
1 parent 316bfc4 commit 01419d6
Show file tree
Hide file tree
Showing 15 changed files with 5,564 additions and 7,130 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ Thumbs.db

# we use npm
yarn.lock

.nx/cache
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.19.0
v20
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

/dist
/coverage

/.nx/cache
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"recommendations": [
"nrwl.angular-console",
"angular.ng-template",
"ms-vscode.vscode-typescript-tslint-plugin",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
]
Expand Down
5 changes: 2 additions & 3 deletions libs/ng-mockito/integration/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
"prefix": "qp",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["libs/ng-mockito/integration/src/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "libs/ng-mockito/integration/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/ng-mockito/integration/jest.config.ts"
},
"outputs": ["{workspaceRoot}/coverage/libs/ng-mockito/integration"]
}
Expand Down
5 changes: 2 additions & 3 deletions libs/ng-mockito/ng-mockito/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["libs/ng-mockito/ng-mockito/src/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "libs/ng-mockito/ng-mockito/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/ng-mockito/ng-mockito/jest.config.ts"
},
"outputs": ["{workspaceRoot}/coverage/libs/ng-mockito/ng-mockito"]
}
Expand Down
10 changes: 5 additions & 5 deletions libs/ng-mockito/ng-mockito/src/lib/mock-provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ describe.each`
it('should throw error if ts-mockito instance is given', () => {
expect(() =>
mockProvider(tsMockito.instance(tsMockito.mock(class TestService {})))
).toThrowError(
).toThrow(
/.*Constructor name was empty, maybe you used instance\(\) function\?.*/
);
});

it('should throw error if instance is given', () => {
class TestService {}

expect(() => mockProvider(new TestService())).toThrowError(
expect(() => mockProvider(new TestService())).toThrow(
/instance of TestService/
);
});

it('should throw error if object is given', () => {
expect(() => mockProvider({})).toThrowError(/instance of Object/);
expect(() => mockProvider({})).toThrow(/instance of Object/);
});

it('should throw error if other value is given', () => {
expect(() => mockProvider('test')).toThrowError(/invalid type./);
expect(() => mockProvider('test')).toThrow(/invalid type./);
});

it('should mock ActivatedRoute', () => {
Expand Down Expand Up @@ -63,7 +63,7 @@ describe.each`
const heavyweightService = TestBed.inject(HeavyweightService);
expect(() =>
heavyweightService.doSomeHeavyweightStuff()
).not.toThrowError();
).not.toThrow();
});

it('should be able to set up inline', async () => {
Expand Down
4 changes: 3 additions & 1 deletion libs/ng-mockito/ng-mockito/src/lib/mock-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import { isMock } from './ts-mockito-helpers';
*/
export type TokenWithClient<T, U> = Readonly<[InjectionToken<T>, Type<U>]>;

export type TokenConfigValue<T> = { use: T };
export interface TokenConfigValue<T> {
use: T;
}

type ValueType =
| boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('Angular decorator helpers', () => {
@Component({ template: 'test' })
class TestComponent {}

expect(() => getDecoratorMetadata(TestComponent, 'Pipe')).toThrowError(
expect(() => getDecoratorMetadata(TestComponent, 'Pipe')).toThrow(
/Did not find decorator Pipe. Found: Component/
);
});
Expand Down
4 changes: 2 additions & 2 deletions libs/ng-mockito/ng-mockito/src/lib/ts-mockito-helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('ts-mockito helpers', () => {
`(
'should throw error if argument is $description',
({ argument, expectedMessage }) => {
expect(() => createTypeAndMock(argument)).toThrowError(expectedMessage);
expect(() => createTypeAndMock(argument)).toThrow(expectedMessage);
}
);

Expand All @@ -51,7 +51,7 @@ describe('ts-mockito helpers', () => {
`(
'when using an $description should include $expectedMessage as info when throwing an error',
({ argument, expectedMessage }) => {
expect(() => createTypeAndMock(argument)).toThrowError(expectedMessage);
expect(() => createTypeAndMock(argument)).toThrow(expectedMessage);
}
);

Expand Down
5 changes: 4 additions & 1 deletion libs/ng-mockito/ng-mockito/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
export type Type<T> = Function & { prototype: T };

export type TypeOrMock<T> = Type<T> | T;
export type TypeAndMock<T> = { type: Type<T>; mock: T };
export interface TypeAndMock<T> {
type: Type<T>;
mock: T;
}

export type SetupMockFn<T> = (m: T) => void;
Loading

0 comments on commit 01419d6

Please sign in to comment.