Skip to content

Commit

Permalink
chore(frontend): polyfill jest to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Falinor committed Dec 19, 2024
1 parent b6b791b commit 0ba34e0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
6 changes: 4 additions & 2 deletions frontend/jest.polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

const { TextDecoder, TextEncoder } = require('node:util');
const { ReadableStream, TransformStream } = require('node:stream/web');
const { BroadcastChannel } = require('node:worker_threads')

Object.defineProperties(globalThis, {
ReadableStream: { value: ReadableStream },
Expand All @@ -22,13 +23,14 @@ const { Blob, File } = require('node:buffer');
const { fetch, Headers, FormData, Request, Response } = require('undici');

Object.defineProperties(globalThis, {
fetch: { value: fetch, writable: true },
fetch: { value: fetch, writable: true, configurable: true },
Blob: { value: Blob },
File: { value: File },
Headers: { value: Headers },
FormData: { value: FormData },
Request: { value: Request, configurable: true },
Response: { value: Response, configurable: true }
Response: { value: Response, configurable: true },
BroadcastChannel: { value: BroadcastChannel },
});

Object.defineProperty(window, 'matchMedia', {
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"@craco/craco": "^7.1.0",
"@faker-js/faker": "^8.4.1",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"@tsconfig/create-react-app": "^2.0.5",
"@types/async": "^3.2.24",
Expand Down
49 changes: 25 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6808,7 +6808,7 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/jest-dom@npm:^6.5.0, @testing-library/jest-dom@npm:^6.6.2":
"@testing-library/jest-dom@npm:^6.6.2, @testing-library/jest-dom@npm:^6.6.3":
version: 6.6.3
resolution: "@testing-library/jest-dom@npm:6.6.3"
dependencies:
Expand All @@ -6823,7 +6823,7 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/react@npm:^16.0.1":
"@testing-library/react@npm:^16.1.0":
version: 16.1.0
resolution: "@testing-library/react@npm:16.1.0"
dependencies:
Expand Down Expand Up @@ -9385,11 +9385,11 @@ __metadata:
linkType: hard

"@types/react@npm:*":
version: 19.0.1
resolution: "@types/react@npm:19.0.1"
version: 19.0.2
resolution: "@types/react@npm:19.0.2"
dependencies:
csstype: "npm:^3.0.2"
checksum: 10c0/25eb69114abb9a6d5fc4414ee584388275bbc9ac32976449cf58b95fe9880efe6b3f936c3842be9bed8c571546a9752e8d3e2095288381e9c809269f5f574f2e
checksum: 10c0/8992f39701fcf1bf893ef8f94a56196445667baf08fe4f6050a14e229a17aad3265ad3efc01595ff3b4d5d5c69da885f9aa4ff80f164a613018734efcff1eb8f
languageName: node
linkType: hard

Expand Down Expand Up @@ -10264,8 +10264,8 @@ __metadata:
"@reduxjs/toolkit": "npm:^1.9.7"
"@tanstack/react-table": "npm:^8.20.5"
"@testing-library/dom": "npm:^10.4.0"
"@testing-library/jest-dom": "npm:^6.5.0"
"@testing-library/react": "npm:^16.0.1"
"@testing-library/jest-dom": "npm:^6.6.3"
"@testing-library/react": "npm:^16.1.0"
"@testing-library/user-event": "npm:^14.5.2"
"@tsconfig/create-react-app": "npm:^2.0.5"
"@turf/turf": "npm:^7.1.0"
Expand Down Expand Up @@ -18443,11 +18443,11 @@ __metadata:
linkType: hard

"is-shared-array-buffer@npm:^1.0.3":
version: 1.0.3
resolution: "is-shared-array-buffer@npm:1.0.3"
version: 1.0.4
resolution: "is-shared-array-buffer@npm:1.0.4"
dependencies:
call-bind: "npm:^1.0.7"
checksum: 10c0/adc11ab0acbc934a7b9e5e9d6c588d4ec6682f6fea8cda5180721704fa32927582ede5b123349e32517fdadd07958973d24716c80e7ab198970c47acc09e59c7
call-bound: "npm:^1.0.3"
checksum: 10c0/65158c2feb41ff1edd6bbd6fd8403a69861cf273ff36077982b5d4d68e1d59278c71691216a4a64632bd76d4792d4d1d2553901b6666d84ade13bba5ea7bc7db
languageName: node
linkType: hard

Expand Down Expand Up @@ -18519,11 +18519,11 @@ __metadata:
linkType: hard

"is-typed-array@npm:^1.1.13, is-typed-array@npm:^1.1.14":
version: 1.1.14
resolution: "is-typed-array@npm:1.1.14"
version: 1.1.15
resolution: "is-typed-array@npm:1.1.15"
dependencies:
which-typed-array: "npm:^1.1.16"
checksum: 10c0/1dc1aee98fcdc016b941491f32327b6f651580efe8e0e0fe9a659f7f8a901c0047f9929de4fad08eb4a7f2b9ae42551c08fa054bfb6bfa16109e80b9abab66b2
checksum: 10c0/415511da3669e36e002820584e264997ffe277ff136643a3126cc949197e6ca3334d0f12d084e83b1994af2e9c8141275c741cf2b7da5a2ff62dd0cac26f76c4
languageName: node
linkType: hard

Expand Down Expand Up @@ -29104,13 +29104,13 @@ __metadata:
linkType: hard

"typed-array-buffer@npm:^1.0.2":
version: 1.0.2
resolution: "typed-array-buffer@npm:1.0.2"
version: 1.0.3
resolution: "typed-array-buffer@npm:1.0.3"
dependencies:
call-bind: "npm:^1.0.7"
call-bound: "npm:^1.0.3"
es-errors: "npm:^1.3.0"
is-typed-array: "npm:^1.1.13"
checksum: 10c0/9e043eb38e1b4df4ddf9dde1aa64919ae8bb909571c1cc4490ba777d55d23a0c74c7d73afcdd29ec98616d91bb3ae0f705fad4421ea147e1daf9528200b562da
is-typed-array: "npm:^1.1.14"
checksum: 10c0/1105071756eb248774bc71646bfe45b682efcad93b55532c6ffa4518969fb6241354e4aa62af679ae83899ec296d69ef88f1f3763657cdb3a4d29321f7b83079
languageName: node
linkType: hard

Expand Down Expand Up @@ -30097,15 +30097,16 @@ __metadata:
linkType: hard

"which-typed-array@npm:^1.1.16":
version: 1.1.16
resolution: "which-typed-array@npm:1.1.16"
version: 1.1.17
resolution: "which-typed-array@npm:1.1.17"
dependencies:
available-typed-arrays: "npm:^1.0.7"
call-bind: "npm:^1.0.7"
call-bind: "npm:^1.0.8"
call-bound: "npm:^1.0.3"
for-each: "npm:^0.3.3"
gopd: "npm:^1.0.1"
gopd: "npm:^1.2.0"
has-tostringtag: "npm:^1.0.2"
checksum: 10c0/a9075293200db4fbce7c24d52731843542c5a19edfc66e31aa2cbefa788b5caa7ef05008f6e60d2c38d8198add6b92d0ddc2937918c5c308be398b1ebd8721af
checksum: 10c0/0d25d9ab36a9ed7d3d6527765b1c4acfdba41d4e8fa2d1f4afaef98f93d9b052aa48623c69c67ff8ab56897156c5586f33c404b2e2769c170092ee63e49bc0af
languageName: node
linkType: hard

Expand Down

0 comments on commit 0ba34e0

Please sign in to comment.