-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
Conversation
Run & review this pull request in StackBlitz Codeflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
peerDependencies
needs to be updated:
spectator/projects/spectator/package.json
Lines 32 to 34 in 9478289
"@angular/common": ">= 16.0.0", | |
"@angular/router": ">= 16.0.0", | |
"@angular/animations": ">= 16.0.0" |
You can add spectator.flushEffects() and also introduce a an API to test defer views. |
Running $ yarn build
yarn run v1.22.21
$ ng build --configuration production && yarn build:schematics && yarn copy:schematics && yarn copy:docs
Building Angular Package
------------------------------------------------------------------------------
Building entry point '@ngneat/spectator/internals'
------------------------------------------------------------------------------
✖ Compiling with Angular sources in Ivy partial compilation mode.
error TS2688: Cannot find type definition file for 'jasmine'.
The file is in the program because:
Entry point of type library 'jasmine' specified in compilerOptions
error TS2688: Cannot find type definition file for 'node'.
The file is in the program because:
Entry point of type library 'node' specified in compilerOptions
error Command failed with exit code 1. Updating
index adeaf7c4..8566c2b4 100644
--- a/projects/spectator/tsconfig.lib.json
+++ b/projects/spectator/tsconfig.lib.json
@@ -6,10 +6,10 @@
"declaration": true,
"inlineSources": true,
"typeRoots": [
+ "../../node_modules/@types",
"./typings"
],
"types": [
- "jasmine",
"jest",
"node"
], -- edit 2023-12-02 -- Suggested incorrect patch. https://devblogs.microsoft.com/typescript/announcing-typescript-5-1/ index adeaf7c4..8566c2b4 100644
--- a/projects/spectator/tsconfig.lib.json
+++ b/projects/spectator/tsconfig.lib.json
@@ -6,10 +6,10 @@
"declaration": true,
"inlineSources": true,
"typeRoots": [
- "./typings"
+ "./typings",
+ "../../node_modules/@types"
], |
Thanks, it's fixed now. I've tried running this on a big project under ng17 with
The generated |
Thanks, that worked. I didn't know about it, pretty handy :) I have just tried the upgrade on an Angular 17 project with 4000+ tests with Spectator and Jest, works fine. |
f963e6a
to
777c67e
Compare
- ran ng update @angular/cli @angular/core - updated eslint dependencies - updated jest dependencies
@@ -6,10 +6,10 @@ | |||
"declaration": true, | |||
"inlineSources": true, | |||
"typeRoots": [ | |||
"../../node_modules/@types", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 fornode_modules/@types
More info: https://devblogs.microsoft.com/typescript/announcing-typescript-5-1/
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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?
@@ -6,10 +6,10 @@ | |||
"declaration": true, | |||
"inlineSources": true, | |||
"typeRoots": [ | |||
"../../node_modules/@types", |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jasmine
type should remain.
@Tommy228 your project is using jest or jasmine? |
My project uses jest, so I didn’t test it under jasmine. Indeed, we should add it back. I can’t update the PR before a few days so feel free to do it if you want to. |
I created a new pull-request. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #631
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Angular recently introduced TestBed.flushEffects() which is a helper function to execute pending effects . I think it makes sense to add
spectator.flushEffects()
but the method is still under dev preview, so maybe not the right time?