Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to Angular 17 #632

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ The `createComponent()` method returns an instance of `Spectator` which exposes
- `component` - The tested component's instance
- `element` - The tested component's native element
- `debugElement` - The tested fixture's debug element
- `flushEffects()` - Provides a wrapper for `TestBed.flushEffects()`

- `inject()` - Provides a wrapper for `TestBed.inject()`:
```ts
Expand Down
53 changes: 27 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,31 @@
"release:dry": "cd projects/spectator && standard-version --infile ../../CHANGELOG.md --dry-run"
},
"devDependencies": {
"@angular-builders/jest": "^16.0.0",
"@angular-devkit/build-angular": "^16.0.0",
"@angular-devkit/schematics": "^16.0.0",
"@angular-eslint/builder": "16.0.1",
"@angular-eslint/eslint-plugin": "16.0.1",
"@angular-eslint/eslint-plugin-template": "16.0.1",
"@angular-eslint/schematics": "16.0.1",
"@angular-eslint/template-parser": "16.0.1",
"@angular/animations": "^16.0.0",
"@angular/cdk": "^16.0.0",
"@angular/cli": "^16.0.0",
"@angular/common": "^16.0.0",
"@angular/compiler": "^16.0.0",
"@angular/compiler-cli": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/forms": "^16.0.0",
"@angular/language-service": "^16.0.0",
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular/router": "16.0.0",
"@angular-builders/jest": "^17.0.0",
"@angular-devkit/build-angular": "^17.0.1",
"@angular-devkit/schematics": "^17.0.1",
"@angular-eslint/builder": "17.1.0",
"@angular-eslint/eslint-plugin": "17.1.0",
"@angular-eslint/eslint-plugin-template": "17.1.0",
"@angular-eslint/schematics": "17.1.0",
"@angular-eslint/template-parser": "17.1.0",
"@angular/animations": "^17.0.3",
"@angular/cdk": "^17.0.1",
"@angular/cli": "^17.0.1",
"@angular/common": "^17.0.3",
"@angular/compiler": "^17.0.3",
"@angular/compiler-cli": "^17.0.3",
"@angular/core": "^17.0.3",
"@angular/forms": "^17.0.3",
"@angular/language-service": "^17.0.3",
"@angular/platform-browser": "^17.0.3",
"@angular/platform-browser-dynamic": "^17.0.3",
"@angular/router": "17.0.3",
"@commitlint/cli": "17.3.0",
"@commitlint/config-angular": "17.3.0",
"@commitlint/config-conventional": "17.3.0",
"@types/jasmine": "3.8.1",
"@types/jest": "29.5.2",
"@types/jest": "29.5.10",
"@types/node": "18.16.5",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
Expand All @@ -68,21 +68,22 @@
"husky": "^8.0.2",
"jasmine-core": "3.8.0",
"jasmine-spec-reporter": "7.0.0",
"jest": "29.5.0",
"jest-preset-angular": "13.1.1",
"jest": "29.7.0",
"jest-preset-angular": "13.1.4",
"karma": "6.3.4",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "4.0.1",
"karma-jasmine-html-reporter": "1.7.0",
"lint-staged": "^13.1.0",
"ng-packagr": "16.0.0",
"ng-packagr": "17.0.1",
"prettier": "2.3.2",
"rxjs": "6.6.3",
"standard-version": "^9.1.0",
"ts-node": "10.1.0",
"typescript": "5.0.4",
"zone.js": "0.13.0"
"tslib": "^2.6.2",
"typescript": "5.2.2",
"zone.js": "0.14.2"
},
"config": {
"commitizen": {
Expand Down
6 changes: 3 additions & 3 deletions projects/spectator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"tslib": "^2.1.0"
},
"peerDependencies": {
"@angular/common": ">= 16.0.0",
"@angular/router": ">= 16.0.0",
"@angular/animations": ">= 16.0.0"
"@angular/common": ">= 17.0.0",
"@angular/router": ">= 17.0.0",
"@angular/animations": ">= 17.0.0"
},
"schematics": "./schematics/collection.json"
}
7 changes: 7 additions & 0 deletions projects/spectator/src/lib/base/base-spectator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ export abstract class BaseSpectator {
public inject<T>(token: Token<T>): SpyObject<T> {
return TestBed.inject ? TestBed.inject(token) : TestBed.get(token);
}

/**
* Execute any pending effects.
*/
public flushEffects(): void {
TestBed.flushEffects();
}
}
2 changes: 1 addition & 1 deletion projects/spectator/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"declaration": true,
"inlineSources": true,
"typeRoots": [
"../../node_modules/@types",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this change, please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typescript got upgraded from 5.0.4 to 5.2.2

Typescript 5.1 introduced a change in typeRoots behaviour:

Explicit typeRoots Disables Upward Walks for node_modules/@types

More info: https://devblogs.microsoft.com/typescript/announcing-typescript-5-1/

Copy link
Contributor

@chimurai chimurai Dec 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the Microsoft documentation the order of typeRoots should be corrected to:

    "typeRoots": [
      "./typings",
      "../../node_modules/@types"
    ],

"./typings"
],
"types": [
"jasmine",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we remove jasmine from here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jasmine type should remain.

"jest",
"node"
],
Expand Down
Loading