Skip to content

Commit be860e4

Browse files
authored
Merge pull request #231 from pactflow/deps/cypress_axios
deps
2 parents df7d727 + f2a66ee commit be860e4

File tree

13 files changed

+2587
-1510
lines changed

13 files changed

+2587
-1510
lines changed

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [macos-latest, ubuntu-latest, windows-latest]
15-
node-version: [18.x, 19.x, 20.x]
15+
node-version: [18.x, 20.x, 22.x]
1616
fail-fast: false
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v3
21+
uses: actions/setup-node@v4
2222
with:
2323
node-version: ${{ matrix.node-version }}
2424
- run: yarn install

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
release:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0
16-
- uses: actions/setup-node@v3
16+
- uses: actions/setup-node@v4
1717
with:
1818
node-version: 18
1919
registry-url: 'https://registry.npmjs.org'
@@ -23,7 +23,7 @@ jobs:
2323
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTOMATION_TOKEN}}
2424
- name: Create Release
2525
id: create_release
26-
uses: softprops/action-gh-release@v1
26+
uses: softprops/action-gh-release@v2
2727
env:
2828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
2929
with:

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/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "pact-consumer-example",
33
"version": "0.1.0",
44
"dependencies": {
5-
"axios": "^0.28.0",
5+
"axios": "^1.7.9",
66
"prop-types": "15.8.1",
7-
"react": "^16.12.0",
8-
"react-dom": "^16.12.0",
7+
"react": "^16.14.0",
8+
"react-dom": "^16.14.0",
99
"react-router": "5.3.4",
1010
"react-router-dom": "^5.3.4",
1111
"react-scripts": "5.0.1",
12-
"spectre.css": "^0.5.8"
12+
"spectre.css": "^0.5.9"
1313
},
1414
"scripts": {
1515
"start": "cross-env GENERATE_SOURCEMAP=false react-scripts start",
@@ -37,27 +37,27 @@
3737
]
3838
},
3939
"devDependencies": {
40-
"@testing-library/jest-dom": "^4.2.4",
41-
"@types/axios": "^0.14.0",
42-
"@types/react": "^17.0.53",
43-
"@types/react-dom": "^17.0.19",
40+
"@babel/runtime": "^7.26.0",
41+
"@testing-library/jest-dom": "^6.6.3",
42+
"@types/react": "^17.0.83",
43+
"@types/react-dom": "^17.0.26",
4444
"@types/react-router-dom": "^5.3.3",
45-
"@typescript-eslint/eslint-plugin": "^2.34.0",
45+
"@typescript-eslint/eslint-plugin": "^8.18.0",
4646
"@typescript-eslint/parser": "^2.34.0",
47-
"babel-eslint": "^10.0.3",
47+
"babel-eslint": "^10.1.0",
4848
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
4949
"cross-env": "^7.0.3",
50-
"cypress": "^9.5.1",
50+
"cypress": "13.16.1",
5151
"cypress-log-to-output": "^1.1.2",
5252
"eslint": "^6.8.0",
53-
"eslint-config-react-app": "^5.2.1",
53+
"eslint-config-react-app": "^7.0.1",
5454
"eslint-plugin-flowtype": "^8.0.3",
55-
"eslint-plugin-import": "^2.27.5",
56-
"eslint-plugin-jsx-a11y": "^6.7.1",
57-
"eslint-plugin-react": "^7.32.2",
58-
"eslint-plugin-react-hooks": "^4.6.0",
55+
"eslint-plugin-import": "^2.31.0",
56+
"eslint-plugin-jsx-a11y": "^6.10.2",
57+
"eslint-plugin-react": "^7.37.2",
58+
"eslint-plugin-react-hooks": "^4.6.2",
5959
"js-levenshtein": "^1.1.6",
60-
"start-server-and-test": "^1.14.0",
60+
"start-server-and-test": "^1.15.5",
6161
"undici": "^5.28.4"
6262
},
6363
"msw": {

examples/react/public/mockServiceWorker.js

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

44
/**
5-
* Mock Service Worker (2.0.2).
5+
* Mock Service Worker (2.0.14).
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 INTEGRITY_CHECKSUM = 'c5f7f8e188b673ea4e677df7ea3c5a39'
1212
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
1313
const activeClientIds = new Set()
1414

@@ -121,11 +121,6 @@ async function handleRequest(event, requestId) {
121121
if (client && activeClientIds.has(client.id)) {
122122
;(async function () {
123123
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
129124

130125
sendToClient(
131126
client,
@@ -137,11 +132,11 @@ async function handleRequest(event, requestId) {
137132
type: responseClone.type,
138133
status: responseClone.status,
139134
statusText: responseClone.statusText,
140-
body: responseBody,
135+
body: responseClone.body,
141136
headers: Object.fromEntries(responseClone.headers.entries()),
142137
},
143138
},
144-
[responseBody],
139+
[responseClone.body],
145140
)
146141
})()
147142
}

0 commit comments

Comments
 (0)