Skip to content

Commit 8e4323d

Browse files
bors[bot]bidoubiwa
andauthored
Merge #755
755: Temp fix for failing node v10 r=bidoubiwa a=bidoubiwa This fixes the failing tests until this has changed jsdom/jsdom#2961 Tests were failing because of the latest version of `JSdom` that introduced this bug: jsdom/jsdom#2961. We only have the bug now as we have updated jest to its latest version. Multiple solutions are considerable: - Adding a resolution to a previous version of jsdom which works with yarn but not npm - Add a polyfill for globalThis - Remove node 10 from test until resolved: loilo/livy@83de8b1 - Change the JsDom version used by explicitly telling so in jest config (which is kinda what `create-react-app` (85k stars) did but [without using an external library](https://github.com/facebook/create-react-app/pull/8955/files#diff-2f231dbdc363c929e899c94ae0d999f9886fdc6e33fb88d498a6b101a4bf9f68R62)) I went for the last option. Another thing to consider is that [Node 10 is almost EOL](https://github.com/nodejs/Release) (end of life) We might consider dropping support in the futur <img width="986" alt="Screenshot 2021-01-19 at 16 57 25" src="https://user-images.githubusercontent.com/33010418/105059332-7413e100-5a77-11eb-8845-48edc3c24382.png"> Co-authored-by: Charlotte Vermandel <[email protected]>
2 parents 2c0c184 + 79fa034 commit 8e4323d

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ const config = {
2222
{
2323
preset: 'ts-jest',
2424
displayName: 'dom',
25-
testEnvironment: 'jsdom',
25+
// TODO: Change this value back to jsdom once once `globalThis` issue is resolved
26+
// Also uninstall jest-environment-jsdom-sixteen
27+
// https://github.com/jsdom/jsdom/issues/2961
28+
testEnvironment: 'jest-environment-jsdom-sixteen',
2629
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
2730
testPathIgnorePatterns: ['meilisearch-test-utils', 'env/'],
2831
},

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"eslint-plugin-standard": "5",
8585
"gzip-size": "^6.0.0",
8686
"jest": "^26.6.3",
87+
"jest-environment-jsdom-sixteen": "^1.0.3",
8788
"jest-watch-typeahead": "^0.5.0",
8889
"kleur": "^4.0.0",
8990
"lint-staged": "10.5.1",

yarn.lock

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,17 @@
10861086
"@types/node" "*"
10871087
jest-mock "^26.6.2"
10881088

1089+
"@jest/fake-timers@^25.1.0":
1090+
version "25.5.0"
1091+
resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-25.5.0.tgz#46352e00533c024c90c2bc2ad9f2959f7f114185"
1092+
integrity sha512-9y2+uGnESw/oyOI3eww9yaxdZyHq7XvprfP/eeoCsjqKYts2yRlsHS/SgjPDV8FyMfn2nbMy8YzUk6nyvdLOpQ==
1093+
dependencies:
1094+
"@jest/types" "^25.5.0"
1095+
jest-message-util "^25.5.0"
1096+
jest-mock "^25.5.0"
1097+
jest-util "^25.5.0"
1098+
lolex "^5.0.0"
1099+
10891100
"@jest/fake-timers@^26.6.2":
10901101
version "26.6.2"
10911102
resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.6.2.tgz#459c329bcf70cee4af4d7e3f3e67848123535aad"
@@ -3624,6 +3635,16 @@ jest-each@^26.6.2:
36243635
jest-util "^26.6.2"
36253636
pretty-format "^26.6.2"
36263637

3638+
jest-environment-jsdom-sixteen@^1.0.3:
3639+
version "1.0.3"
3640+
resolved "https://registry.yarnpkg.com/jest-environment-jsdom-sixteen/-/jest-environment-jsdom-sixteen-1.0.3.tgz#e222228fac537ef15cca5ad470b19b47d9690165"
3641+
integrity sha512-CwMqDUUfSl808uGPWXlNA1UFkWFgRmhHvyAjhCmCry6mYq4b/nn80MMN7tglqo5XgrANIs/w+mzINPzbZ4ZZrQ==
3642+
dependencies:
3643+
"@jest/fake-timers" "^25.1.0"
3644+
jest-mock "^25.1.0"
3645+
jest-util "^25.1.0"
3646+
jsdom "^16.2.1"
3647+
36273648
jest-environment-jsdom@^26.6.2:
36283649
version "26.6.2"
36293650
resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.6.2.tgz#78d09fe9cf019a357009b9b7e1f101d23bd1da3e"
@@ -3746,6 +3767,13 @@ jest-message-util@^26.6.2:
37463767
slash "^3.0.0"
37473768
stack-utils "^2.0.2"
37483769

3770+
jest-mock@^25.1.0, jest-mock@^25.5.0:
3771+
version "25.5.0"
3772+
resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-25.5.0.tgz#a91a54dabd14e37ecd61665d6b6e06360a55387a"
3773+
integrity sha512-eXWuTV8mKzp/ovHc5+3USJMYsTBhyQ+5A1Mak35dey/RG8GlM4YWVylZuGgVXinaW6tpvk/RSecmF37FKUlpXA==
3774+
dependencies:
3775+
"@jest/types" "^25.5.0"
3776+
37493777
jest-mock@^26.6.2:
37503778
version "26.6.2"
37513779
resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.6.2.tgz#d6cb712b041ed47fe0d9b6fc3474bc6543feb302"
@@ -3881,7 +3909,7 @@ jest-snapshot@^26.6.2:
38813909
pretty-format "^26.6.2"
38823910
semver "^7.3.2"
38833911

3884-
jest-util@^25.5.0:
3912+
jest-util@^25.1.0, jest-util@^25.5.0:
38853913
version "25.5.0"
38863914
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-25.5.0.tgz#31c63b5d6e901274d264a4fec849230aa3fa35b0"
38873915
integrity sha512-KVlX+WWg1zUTB9ktvhsg2PXZVdkI1NBevOJSkTKYAyXyH4QSvh+Lay/e/v+bmaFfrkfx43xD8QTfgobzlEXdIA==
@@ -4004,7 +4032,7 @@ jsdoctypeparser@^9.0.0:
40044032
resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz#8c97e2fb69315eb274b0f01377eaa5c940bd7b26"
40054033
integrity sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw==
40064034

4007-
jsdom@^16.4.0:
4035+
jsdom@^16.2.1, jsdom@^16.4.0:
40084036
version "16.4.0"
40094037
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.4.0.tgz#36005bde2d136f73eee1a830c6d45e55408edddb"
40104038
integrity sha512-lYMm3wYdgPhrl7pDcRmvzPhhrGVBeVhPIqeHjzeiHN3DFmD1RBpbExbi8vU7BJdH8VAZYovR8DMt0PNNDM7k8w==
@@ -4254,6 +4282,13 @@ log-update@^4.0.0:
42544282
slice-ansi "^4.0.0"
42554283
wrap-ansi "^6.2.0"
42564284

4285+
lolex@^5.0.0:
4286+
version "5.1.2"
4287+
resolved "https://registry.yarnpkg.com/lolex/-/lolex-5.1.2.tgz#953694d098ce7c07bc5ed6d0e42bc6c0c6d5a367"
4288+
integrity sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==
4289+
dependencies:
4290+
"@sinonjs/commons" "^1.7.0"
4291+
42574292
lru-cache@^6.0.0:
42584293
version "6.0.0"
42594294
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"

0 commit comments

Comments
 (0)