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: support jest 26 #374

Merged
merged 1 commit into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog (master)

#### Features

* Support Jest 26 ([#374](https://github.com/thymikee/jest-preset-angular/pull/374))

### v8.2.0

#### Features
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,10 @@ Reference: https://github.com/facebook/jest/issues/708

### Configure other JSDOM versions

**Jest** v25 by default uses **JSDOM** 15 to support Node 8, which should also be compatible with Jest 24 and earlier.
**Jest** v26 by default uses **JSDOM** 16 to support Node 10+.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is JSDOM 16 compatible with Jest 25 ? I'm not sure what to write here. Any thoughts ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It should be. But in 99% of the cases, whoever uses Jest v26 will be happy to use JSDOMv16 and Nodev10.
JSDOM is not a interesting test-target like IE11 or Edge, so a specific setup will not be wanted by 99% of jest users.

I think we can remove that "should also be compatible" part like you did 👍

Copy link
Owner

Choose a reason for hiding this comment

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

jest-environment-jsdom-sixteen et. al. are compatible with any version of Jest. Knowing jsdom project, they'll drop Node 10 way earlier than Jest does, so this section may still be handy. You could provide references to specific tags, so people on lower versions can refer to

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I brought back the part for providing references to specific tags as suggestion :)


If you need a newer JSDOM than the one that ships with Jest and run Node >=10, you can install `jest-environment-jsdom-sixteen` package, and edit your Jest config like so:
If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment
package, e.g. `jest-environment-jsdom-sixteen` and edit your Jest config like so:

```
{
Expand Down
38 changes: 19 additions & 19 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~9.1.0",
"@angular/common": "~9.1.0",
"@angular/compiler": "~9.1.0",
"@angular/core": "~9.1.0",
"@angular/forms": "~9.1.0",
"@angular/platform-browser": "~9.1.0",
"@angular/platform-browser-dynamic": "~9.1.0",
"@angular/router": "~9.1.0",
"rxjs": "~6.5.4",
"@angular/animations": "~9.1.7",
"@angular/common": "~9.1.7",
"@angular/compiler": "~9.1.7",
"@angular/core": "~9.1.7",
"@angular/forms": "~9.1.7",
"@angular/platform-browser": "~9.1.7",
"@angular/platform-browser-dynamic": "~9.1.7",
"@angular/router": "~9.1.7",
"rxjs": "~6.5.5",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.0",
"@angular/cli": "~9.1.0",
"@angular/compiler-cli": "~9.1.0",
"@angular/language-service": "~9.1.0",
"@types/jest": "^25.1.1",
"@types/node": "^11.0.0",
"jest": "^25.1.0",
"@angular-devkit/build-angular": "~0.901.6",
"@angular/cli": "~9.1.6",
"@angular/compiler-cli": "~9.1.7",
"@angular/language-service": "~9.1.7",
"@types/jest": "^25.2.2",
"@types/node": "^14.0.1",
"jest": "^26.0.1",
"jest-preset-angular": "file:../",
"ts-node": "^8.0.3",
"typescript": "~3.7.5"
"ts-node": "^8.10.1",
"typescript": "~3.8.3"
}
}
}