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

Update dependency msw to v2.6.7 #321

Merged
merged 2 commits into from
Dec 9, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"hacktimer": "1.1.3",
"husky": "9.1.1",
"loglevel": "1.9.1",
"msw": "2.3.5",
"msw": "2.6.7",
"react": "18.3.1",
"react-colorful": "5.6.1",
"react-dom": "18.3.1",
Expand Down
39 changes: 31 additions & 8 deletions public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* - Please do NOT serve this file on production.
*/

const PACKAGE_VERSION = '2.3.5'
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
const PACKAGE_VERSION = '2.6.7'
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()

Expand Down Expand Up @@ -62,7 +62,12 @@ self.addEventListener('message', async function (event) {

sendToClient(client, {
type: 'MOCKING_ENABLED',
payload: true,
payload: {
client: {
id: client.id,
frameType: client.frameType,
},
},
})
break
}
Expand Down Expand Up @@ -155,6 +160,10 @@ async function handleRequest(event, requestId) {
async function resolveMainClient(event) {
const client = await self.clients.get(event.clientId)

if (activeClientIds.has(event.clientId)) {
return client
}

if (client?.frameType === 'top-level') {
return client
}
Expand Down Expand Up @@ -183,12 +192,26 @@ async function getResponse(event, client, requestId) {
const requestClone = request.clone()

function passthrough() {
const headers = Object.fromEntries(requestClone.headers.entries())
// Cast the request headers to a new Headers instance
// so the headers can be manipulated with.
const headers = new Headers(requestClone.headers)

// Remove the "accept" header value that marked this request as passthrough.
// This prevents request alteration and also keeps it compliant with the
// user-defined CORS policies.
const acceptHeader = headers.get('accept')
if (acceptHeader) {
const values = acceptHeader.split(',').map((value) => value.trim())
const filteredValues = values.filter(
(value) => value !== 'msw/passthrough',
)

// Remove internal MSW request header so the passthrough request
// complies with any potential CORS preflight checks on the server.
// Some servers forbid unknown request headers.
delete headers['x-msw-intention']
if (filteredValues.length > 0) {
headers.set('accept', filteredValues.join(', '))
} else {
headers.delete('accept')
}
}

return fetch(requestClone, { headers })
}
Expand Down
10 changes: 9 additions & 1 deletion src/search/searchBar.component.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { QueryClient } from '@tanstack/react-query';
import { act, screen, waitFor, within } from '@testing-library/react';
import {
act,
screen,
waitFor,
waitForElementToBeRemoved,
within,
} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { http, HttpResponse } from 'msw';
import React from 'react';
Expand Down Expand Up @@ -776,6 +782,8 @@ describe('searchBar component', () => {

await user.click(screen.getByLabelText('close shot number search box'));

await waitForElementToBeRemoved(() => screen.queryByText('7 days'));

// Max shots

const maxShotsRadioGroup = screen.getByRole('radiogroup', {
Expand Down
156 changes: 66 additions & 90 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ __metadata:
languageName: node
linkType: hard

"@bundled-es-modules/cookie@npm:^2.0.0":
version: 2.0.0
resolution: "@bundled-es-modules/cookie@npm:2.0.0"
"@bundled-es-modules/cookie@npm:^2.0.1":
version: 2.0.1
resolution: "@bundled-es-modules/cookie@npm:2.0.1"
dependencies:
cookie: "npm:^0.5.0"
checksum: 10c0/0655dd331b35d7b5b6dd2301c3bcfb7233018c0e3235a40ced1d53f00463ab92dc01f0091f153812867bc0ef0f8e0a157a30acb16e8d7ef149702bf8db9fe7a6
cookie: "npm:^0.7.2"
checksum: 10c0/dfac5e36127e827c5557b8577f17a8aa94c057baff6d38555917927b99da0ecf0b1357e7fedadc8853ecdbd4a8a7fa1f5e64111b2a656612f4a36376f5bdbe8d
languageName: node
linkType: hard

Expand Down Expand Up @@ -867,50 +867,48 @@ __metadata:
languageName: node
linkType: hard

"@inquirer/confirm@npm:^3.0.0":
version: 3.2.0
resolution: "@inquirer/confirm@npm:3.2.0"
"@inquirer/confirm@npm:^5.0.0":
version: 5.1.0
resolution: "@inquirer/confirm@npm:5.1.0"
dependencies:
"@inquirer/core": "npm:^9.1.0"
"@inquirer/type": "npm:^1.5.3"
checksum: 10c0/a2cbfc8ae9c880bba4cce1993f5c399fb0d12741fdd574917c87fceb40ece62ffa60e35aaadf4e62d7c114f54008e45aee5d6d90497bb62d493996c02725d243
"@inquirer/core": "npm:^10.1.1"
"@inquirer/type": "npm:^3.0.1"
peerDependencies:
"@types/node": ">=18"
checksum: 10c0/c75e91a84839c800a7176e3c790368656c505f6f8c1f8e7cd022055eb31d75d73ac847224061791f6c35e71be35fac52d2efb976e4709884d00d4968e37630c7
languageName: node
linkType: hard

"@inquirer/core@npm:^9.1.0":
version: 9.1.0
resolution: "@inquirer/core@npm:9.1.0"
"@inquirer/core@npm:^10.1.1":
version: 10.1.1
resolution: "@inquirer/core@npm:10.1.1"
dependencies:
"@inquirer/figures": "npm:^1.0.5"
"@inquirer/type": "npm:^1.5.3"
"@types/mute-stream": "npm:^0.0.4"
"@types/node": "npm:^22.5.2"
"@types/wrap-ansi": "npm:^3.0.0"
"@inquirer/figures": "npm:^1.0.8"
"@inquirer/type": "npm:^3.0.1"
ansi-escapes: "npm:^4.3.2"
cli-spinners: "npm:^2.9.2"
cli-width: "npm:^4.1.0"
mute-stream: "npm:^1.0.0"
mute-stream: "npm:^2.0.0"
signal-exit: "npm:^4.1.0"
strip-ansi: "npm:^6.0.1"
wrap-ansi: "npm:^6.2.0"
yoctocolors-cjs: "npm:^2.1.2"
checksum: 10c0/c86cbd1980788dee4151002ed717b5664a79eec1d925e1b38896bbad079647af5c423eaaa39a2291ba4fdf78a33c541ea3f69cbbf030f03815eb523fa05230f8
checksum: 10c0/7c3b50b5a8c673d2b978684c39b8d65249145cbc859b598d4d0be9af1d2f30731228996ff8143a8fca1b776f76040d83ae241807291144f6205c23b93e33d408
languageName: node
linkType: hard

"@inquirer/figures@npm:^1.0.5":
version: 1.0.5
resolution: "@inquirer/figures@npm:1.0.5"
checksum: 10c0/ec9ba23db42cb33fa18eb919abf2a18e750e739e64c1883ce4a98345cd5711c60cac12d1faf56a859f52d387deb221c8d3dfe60344ee07955a9a262f8b821fe3
"@inquirer/figures@npm:^1.0.8":
version: 1.0.8
resolution: "@inquirer/figures@npm:1.0.8"
checksum: 10c0/34d287ff1fd16476c58bbd5b169db315f8319b5ffb09f81a1bb9aabd4165114e7406b1f418d021fd9cd48923008446e3eec274bb818f378ea132a0450bbc91d4
languageName: node
linkType: hard

"@inquirer/type@npm:^1.5.3":
version: 1.5.3
resolution: "@inquirer/type@npm:1.5.3"
dependencies:
mute-stream: "npm:^1.0.0"
checksum: 10c0/da92a7410efcb20cf12422558fb8e00136e2ff1746ae1d17ea05511e77139bf2044527d37a70e77f188f158099f7751ed808ca3f82769cbe99c1052509481e95
"@inquirer/type@npm:^3.0.1":
version: 3.0.1
resolution: "@inquirer/type@npm:3.0.1"
peerDependencies:
"@types/node": ">=18"
checksum: 10c0/c8612362d382114a318dbb523de7b1f54dc6bc6d3016c6eaf299b6a32486b92b0dfb1b4cfc6fe9d99496d15fbb721873a1bd66819f796c8bb09853a3b808812d
languageName: node
linkType: hard

Expand Down Expand Up @@ -984,17 +982,17 @@ __metadata:
languageName: node
linkType: hard

"@mswjs/interceptors@npm:^0.29.0":
version: 0.29.1
resolution: "@mswjs/interceptors@npm:0.29.1"
"@mswjs/interceptors@npm:^0.37.0":
version: 0.37.3
resolution: "@mswjs/interceptors@npm:0.37.3"
dependencies:
"@open-draft/deferred-promise": "npm:^2.2.0"
"@open-draft/logger": "npm:^0.3.0"
"@open-draft/until": "npm:^2.0.0"
is-node-process: "npm:^1.2.0"
outvariant: "npm:^1.2.1"
outvariant: "npm:^1.4.3"
strict-event-emitter: "npm:^0.5.1"
checksum: 10c0/816660a17b0e89e6e6955072b96882b5807c8c9faa316eab27104e8ba80e8e7d78b1862af42e1044156a5ae3ae2071289dc9211ecdc8fd5f7078d8c8a8a7caa3
checksum: 10c0/5a8d9ab7c491d14dff996f23bda0fa7b7059f68a1d4981b804b6114f1c0c0490bc35860df135ed36da1720984323878b1a9d13dbc80936bbfa67b3d3c3476f6c
languageName: node
linkType: hard

Expand Down Expand Up @@ -1849,16 +1847,7 @@ __metadata:
languageName: node
linkType: hard

"@types/mute-stream@npm:^0.0.4":
version: 0.0.4
resolution: "@types/mute-stream@npm:0.0.4"
dependencies:
"@types/node": "npm:*"
checksum: 10c0/944730fd7b398c5078de3c3d4d0afeec8584283bc694da1803fdfca14149ea385e18b1b774326f1601baf53898ce6d121a952c51eb62d188ef6fcc41f725c0dc
languageName: node
linkType: hard

"@types/node@npm:*, @types/node@npm:^22.5.2":
"@types/node@npm:*":
version: 22.5.4
resolution: "@types/node@npm:22.5.4"
dependencies:
Expand Down Expand Up @@ -1970,13 +1959,6 @@ __metadata:
languageName: node
linkType: hard

"@types/wrap-ansi@npm:^3.0.0":
version: 3.0.0
resolution: "@types/wrap-ansi@npm:3.0.0"
checksum: 10c0/8d8f53363f360f38135301a06b596c295433ad01debd082078c33c6ed98b05a5c8fe8853a88265432126096084f4a135ec1564e3daad631b83296905509f90b3
languageName: node
linkType: hard

"@types/yauzl@npm:^2.9.1":
version: 2.10.3
resolution: "@types/yauzl@npm:2.10.3"
Expand Down Expand Up @@ -3117,13 +3099,6 @@ __metadata:
languageName: node
linkType: hard

"cli-spinners@npm:^2.9.2":
version: 2.9.2
resolution: "cli-spinners@npm:2.9.2"
checksum: 10c0/907a1c227ddf0d7a101e7ab8b300affc742ead4b4ebe920a5bf1bc6d45dce2958fcd195eb28fa25275062fe6fa9b109b93b63bc8033396ed3bcb50297008b3a3
languageName: node
linkType: hard

"cli-table3@npm:~0.6.1":
version: 0.6.5
resolution: "cli-table3@npm:0.6.5"
Expand Down Expand Up @@ -3344,10 +3319,10 @@ __metadata:
languageName: node
linkType: hard

"cookie@npm:^0.5.0":
version: 0.5.0
resolution: "cookie@npm:0.5.0"
checksum: 10c0/c01ca3ef8d7b8187bae434434582288681273b5a9ed27521d4d7f9f7928fe0c920df0decd9f9d3bbd2d14ac432b8c8cf42b98b3bdd5bfe0e6edddeebebe8b61d
"cookie@npm:^0.7.2":
version: 0.7.2
resolution: "cookie@npm:0.7.2"
checksum: 10c0/9596e8ccdbf1a3a88ae02cf5ee80c1c50959423e1022e4e60b91dd87c622af1da309253d8abdb258fb5e3eacb4f08e579dc58b4897b8087574eee0fd35dfa5d2
languageName: node
linkType: hard

Expand Down Expand Up @@ -6621,42 +6596,43 @@ __metadata:
languageName: node
linkType: hard

"msw@npm:2.3.5":
version: 2.3.5
resolution: "msw@npm:2.3.5"
"msw@npm:2.6.7":
version: 2.6.7
resolution: "msw@npm:2.6.7"
dependencies:
"@bundled-es-modules/cookie": "npm:^2.0.0"
"@bundled-es-modules/cookie": "npm:^2.0.1"
"@bundled-es-modules/statuses": "npm:^1.0.1"
"@bundled-es-modules/tough-cookie": "npm:^0.1.6"
"@inquirer/confirm": "npm:^3.0.0"
"@mswjs/interceptors": "npm:^0.29.0"
"@inquirer/confirm": "npm:^5.0.0"
"@mswjs/interceptors": "npm:^0.37.0"
"@open-draft/deferred-promise": "npm:^2.2.0"
"@open-draft/until": "npm:^2.1.0"
"@types/cookie": "npm:^0.6.0"
"@types/statuses": "npm:^2.0.4"
chalk: "npm:^4.1.2"
graphql: "npm:^16.8.1"
headers-polyfill: "npm:^4.0.2"
is-node-process: "npm:^1.2.0"
outvariant: "npm:^1.4.2"
path-to-regexp: "npm:^6.2.0"
outvariant: "npm:^1.4.3"
path-to-regexp: "npm:^6.3.0"
strict-event-emitter: "npm:^0.5.1"
type-fest: "npm:^4.9.0"
type-fest: "npm:^4.26.1"
yargs: "npm:^17.7.2"
peerDependencies:
typescript: ">= 4.7.x"
typescript: ">= 4.8.x"
peerDependenciesMeta:
typescript:
optional: true
bin:
msw: cli/index.js
checksum: 10c0/f944d8eb67ccdcf74aba0ce433395a9616420b8b36d43f033635817ef7535553c7bf6854392a95b093546e3481ca99e9017525b6c0bd02f51528b669e672214d
checksum: 10c0/5c61a63043771de8222b03ea90fc5ed4faa2fb9e6e1df12dbe7065414339bc63f76c728f07890e65aec677bb1da7afcababaea51029e3a6bb5906932e6f4b803
languageName: node
linkType: hard

"mute-stream@npm:^1.0.0":
version: 1.0.0
resolution: "mute-stream@npm:1.0.0"
checksum: 10c0/dce2a9ccda171ec979a3b4f869a102b1343dee35e920146776780de182f16eae459644d187e38d59a3d37adf85685e1c17c38cf7bfda7e39a9880f7a1d10a74c
"mute-stream@npm:^2.0.0":
version: 2.0.0
resolution: "mute-stream@npm:2.0.0"
checksum: 10c0/2cf48a2087175c60c8dcdbc619908b49c07f7adcfc37d29236b0c5c612d6204f789104c98cc44d38acab7b3c96f4a3ec2cfdc4934d0738d876dbefa2a12c69f4
languageName: node
linkType: hard

Expand Down Expand Up @@ -6933,7 +6909,7 @@ __metadata:
jsdom: "npm:^25.0.0"
lint-staged: "npm:15.2.0"
loglevel: "npm:1.9.1"
msw: "npm:2.3.5"
msw: "npm:2.6.7"
prettier: "npm:3.3.3"
react: "npm:18.3.1"
react-colorful: "npm:5.6.1"
Expand Down Expand Up @@ -6973,7 +6949,7 @@ __metadata:
languageName: node
linkType: hard

"outvariant@npm:^1.2.1, outvariant@npm:^1.4.0, outvariant@npm:^1.4.2":
"outvariant@npm:^1.4.0, outvariant@npm:^1.4.3":
version: 1.4.3
resolution: "outvariant@npm:1.4.3"
checksum: 10c0/5976ca7740349cb8c71bd3382e2a762b1aeca6f33dc984d9d896acdf3c61f78c3afcf1bfe9cc633a7b3c4b295ec94d292048f83ea2b2594fae4496656eba992c
Expand Down Expand Up @@ -7110,10 +7086,10 @@ __metadata:
languageName: node
linkType: hard

"path-to-regexp@npm:^6.2.0":
version: 6.2.2
resolution: "path-to-regexp@npm:6.2.2"
checksum: 10c0/4b60852d3501fd05ca9dd08c70033d73844e5eca14e41f499f069afa8364f780f15c5098002f93bd42af8b3514de62ac6e82a53b5662de881d2b08c9ef21ea6b
"path-to-regexp@npm:^6.3.0":
version: 6.3.0
resolution: "path-to-regexp@npm:6.3.0"
checksum: 10c0/73b67f4638b41cde56254e6354e46ae3a2ebc08279583f6af3d96fe4664fc75788f74ed0d18ca44fa4a98491b69434f9eee73b97bb5314bd1b5adb700f5c18d6
languageName: node
linkType: hard

Expand Down Expand Up @@ -8805,10 +8781,10 @@ __metadata:
languageName: node
linkType: hard

"type-fest@npm:^4.9.0":
version: 4.26.0
resolution: "type-fest@npm:4.26.0"
checksum: 10c0/3819b65fedd4655ed90703dad9e14248fb61f0a232dce8385e59771bdeaeca08195fe0683d892d62fcd84c0f3bb18bd4b0c3c2ba29023187d267868e75c53076
"type-fest@npm:^4.26.1":
version: 4.30.0
resolution: "type-fest@npm:4.30.0"
checksum: 10c0/9441fbbc971f92a53d7dfdb0db3f9c71a5a33ac3e021ca605cba8ad0b5c0a1e191cc778b4980c534b098ccb4e3322809100baf763be125510c993c9b8361f60e
languageName: node
linkType: hard

Expand Down
Loading