Skip to content

Commit 56915a7

Browse files
committed
chore(deps): update cypress
1 parent 7eaa756 commit 56915a7

File tree

7 files changed

+30
-23
lines changed

7 files changed

+30
-23
lines changed

examples/react/cypress.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const { defineConfig } = require('cypress')
2+
3+
module.exports = defineConfig({
4+
retries: 3,
5+
e2e: {
6+
// We've imported your old cypress plugins here.
7+
// You may want to clean this up later by importing these.
8+
setupNodeEvents(on, config) {
9+
return require('./cypress/plugins/index.js')(on, config)
10+
},
11+
baseUrl: 'http://localhost:3000',
12+
},
13+
})

examples/react/cypress.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/react/cypress/integration/pactFromMswWorker.spec.js renamed to examples/react/cypress/e2e/pactFromMswWorker.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('Tests setupPactMswAdapter with msw works', async () => {
7373
pactMswAdapter.clear();
7474
});
7575

76-
it('should record a msw interaction and turn it into a back', () => {
76+
it('should record a msw interaction and turn it into a pact', () => {
7777
// Filter to the product we want
7878
cy.get('#input-product-search').type('Gem Visa');
7979
cy.get('.btn').click();

examples/react/jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ module.exports = {
1212
"^@bundled-es-modules/js-levenshtein$": "js-levenshtein",
1313
"^@bundled-es-modules/statuses$": "statuses",
1414
"^@bundled-es-modules/cookie$": "cookie",
15+
"^@bundled-es-modules/tough-cookie$": "tough-cookie",
1516
},
1617
setupFiles: [
1718
...config.setupFiles,
1819
'<rootDir>/jest/jest.polyfills.js'
1920
],
21+
"transformIgnorePatterns": [
22+
"node_modules/(?!(axios)/)"
23+
]
2024
}
2125

2226

examples/react/public/mockServiceWorker.js

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
/* tslint:disable */
33

44
/**
5-
* Mock Service Worker (2.0.2).
5+
* Mock Service Worker.
66
* @see https://github.com/mswjs/msw
77
* - Please do NOT modify this file.
88
* - Please do NOT serve this file on production.
99
*/
1010

11-
const INTEGRITY_CHECKSUM = '0877fcdc026242810f5bfde0d7178db4'
11+
const PACKAGE_VERSION = '2.4.11'
12+
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
1213
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
1314
const activeClientIds = new Set()
1415

@@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) {
4849
case 'INTEGRITY_CHECK_REQUEST': {
4950
sendToClient(client, {
5051
type: 'INTEGRITY_CHECK_RESPONSE',
51-
payload: INTEGRITY_CHECKSUM,
52+
payload: {
53+
packageVersion: PACKAGE_VERSION,
54+
checksum: INTEGRITY_CHECKSUM,
55+
},
5256
})
5357
break
5458
}
@@ -121,11 +125,6 @@ async function handleRequest(event, requestId) {
121125
if (client && activeClientIds.has(client.id)) {
122126
;(async function () {
123127
const responseClone = response.clone()
124-
// When performing original requests, response body will
125-
// always be a ReadableStream, even for 204 responses.
126-
// But when creating a new Response instance on the client,
127-
// the body for a 204 response must be null.
128-
const responseBody = response.status === 204 ? null : responseClone.body
129128

130129
sendToClient(
131130
client,
@@ -137,11 +136,11 @@ async function handleRequest(event, requestId) {
137136
type: responseClone.type,
138137
status: responseClone.status,
139138
statusText: responseClone.statusText,
140-
body: responseBody,
139+
body: responseClone.body,
141140
headers: Object.fromEntries(responseClone.headers.entries()),
142141
},
143142
},
144-
[responseBody],
143+
[responseClone.body],
145144
)
146145
})()
147146
}
@@ -207,13 +206,6 @@ async function getResponse(event, client, requestId) {
207206
return passthrough()
208207
}
209208

210-
// Bypass requests with the explicit bypass header.
211-
// Such requests can be issued by "ctx.fetch()".
212-
const mswIntention = request.headers.get('x-msw-intention')
213-
if (['bypass', 'passthrough'].includes(mswIntention)) {
214-
return passthrough()
215-
}
216-
217209
// Notify the client that a request has been intercepted.
218210
const requestBuffer = await request.arrayBuffer()
219211
const clientMessage = await sendToClient(
@@ -245,7 +237,7 @@ async function getResponse(event, client, requestId) {
245237
return respondWithMock(clientMessage.data)
246238
}
247239

248-
case 'MOCK_NOT_FOUND': {
240+
case 'PASSTHROUGH': {
249241
return passthrough()
250242
}
251243
}

src/pactFromMswServer.msw.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,13 @@ describe("API - With MSW mock generating a pact", () => {
143143
expect(pactResults[0].interactions[0].request.headers).toEqual({
144144
accept: "application/json, text/plain, */*",
145145
authorization: expect.any(String),
146+
connection: expect.any(String),
146147
"user-agent": expect.any(String),
147148
});
148149
expect(pactResults[0].interactions[0].response.status).toEqual(200);
149150

150151
expect(pactResults[0].interactions[0].response.headers).toEqual({
152+
"content-length": expect.any(String),
151153
"content-type": "application/json",
152154
});
153155
expect(pactResults[0].interactions[0].response.body).toEqual([

0 commit comments

Comments
 (0)