Skip to content

Commit e0cb584

Browse files
committed
Merge branch 'main' of github.com:cypress-io/cypress-component-testing-apps into chore/add_angular_zoneless_examples
2 parents cea61ed + df4a07c commit e0cb584

File tree

10 files changed

+2206
-2256
lines changed

10 files changed

+2206
-2256
lines changed

react-next15-ts/package-lock.json

Lines changed: 1755 additions & 1763 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react-next15-ts/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
"cypress:run": "cypress run --component"
1111
},
1212
"dependencies": {
13-
"next": "^15.2.3",
14-
"react": "^19.0.0",
15-
"react-dom": "^19.0.0"
13+
"next": "^15.5.9",
14+
"react": "^19.2.3",
15+
"react-dom": "^19.2.3"
1616
},
1717
"devDependencies": {
18-
"@types/node": "^20",
19-
"@types/react": "^18",
20-
"@types/react-dom": "^18",
21-
"cypress": "^15.0.0",
22-
"eslint": "^8",
18+
"@types/node": "^20.19.25",
19+
"@types/react": "^19.2.7",
20+
"@types/react-dom": "^19.2.3",
21+
"cypress": "^15.7.1",
22+
"eslint": "^8.57.1",
2323
"eslint-config-next": "15.2.3",
24-
"msw": "^2.10.5",
25-
"postcss": "^8",
26-
"tailwindcss": "^3.4.1",
27-
"typescript": "^5"
24+
"msw": "^2.12.4",
25+
"postcss": "^8.5.6",
26+
"tailwindcss": "^3.4.18",
27+
"typescript": "^5.9.3"
2828
},
2929
"msw": {
3030
"workerDirectory": [

react-next15-ts/public/mockServiceWorker.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* - Please do NOT modify this file.
88
*/
99

10-
const PACKAGE_VERSION = '2.10.5'
11-
const INTEGRITY_CHECKSUM = 'f5825c521429caf22a4dd13b66e243af'
10+
const PACKAGE_VERSION = '2.12.4'
11+
const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82'
1212
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
1313
const activeClientIds = new Set()
1414

@@ -71,11 +71,6 @@ addEventListener('message', async function (event) {
7171
break
7272
}
7373

74-
case 'MOCK_DEACTIVATE': {
75-
activeClientIds.delete(clientId)
76-
break
77-
}
78-
7974
case 'CLIENT_CLOSED': {
8075
activeClientIds.delete(clientId)
8176

@@ -94,6 +89,8 @@ addEventListener('message', async function (event) {
9489
})
9590

9691
addEventListener('fetch', function (event) {
92+
const requestInterceptedAt = Date.now()
93+
9794
// Bypass navigation requests.
9895
if (event.request.mode === 'navigate') {
9996
return
@@ -110,23 +107,29 @@ addEventListener('fetch', function (event) {
110107

111108
// Bypass all requests when there are no active clients.
112109
// Prevents the self-unregistered worked from handling requests
113-
// after it's been deleted (still remains active until the next reload).
110+
// after it's been terminated (still remains active until the next reload).
114111
if (activeClientIds.size === 0) {
115112
return
116113
}
117114

118115
const requestId = crypto.randomUUID()
119-
event.respondWith(handleRequest(event, requestId))
116+
event.respondWith(handleRequest(event, requestId, requestInterceptedAt))
120117
})
121118

122119
/**
123120
* @param {FetchEvent} event
124121
* @param {string} requestId
122+
* @param {number} requestInterceptedAt
125123
*/
126-
async function handleRequest(event, requestId) {
124+
async function handleRequest(event, requestId, requestInterceptedAt) {
127125
const client = await resolveMainClient(event)
128126
const requestCloneForEvents = event.request.clone()
129-
const response = await getResponse(event, client, requestId)
127+
const response = await getResponse(
128+
event,
129+
client,
130+
requestId,
131+
requestInterceptedAt,
132+
)
130133

131134
// Send back the response clone for the "response:*" life-cycle events.
132135
// Ensure MSW is active and ready to handle the message, otherwise
@@ -202,9 +205,10 @@ async function resolveMainClient(event) {
202205
* @param {FetchEvent} event
203206
* @param {Client | undefined} client
204207
* @param {string} requestId
208+
* @param {number} requestInterceptedAt
205209
* @returns {Promise<Response>}
206210
*/
207-
async function getResponse(event, client, requestId) {
211+
async function getResponse(event, client, requestId, requestInterceptedAt) {
208212
// Clone the request because it might've been already used
209213
// (i.e. its body has been read and sent to the client).
210214
const requestClone = event.request.clone()
@@ -255,6 +259,7 @@ async function getResponse(event, client, requestId) {
255259
type: 'REQUEST',
256260
payload: {
257261
id: requestId,
262+
interceptedAt: requestInterceptedAt,
258263
...serializedRequest,
259264
},
260265
},

0 commit comments

Comments
 (0)