Skip to content

Commit 4d904e2

Browse files
authored
chore: refactor @packages/https-proxy to TypeScript and use vitest instead of mocha (#32718)
* chore: convert @packages/https-proxy to TypeScript and use vitest instead of mocha * chore: address comments from code review * Update packages/https-proxy/vitest.config.ts
1 parent f31302c commit 4d904e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1616
-1540
lines changed

.circleci/cache-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Bump this version to force CI to re-create the cache from scratch.
2-
10-10-2025
2+
10-14-2025

.circleci/src/pipeline/@pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ jobs:
17851785
source ./scripts/ensure-node.sh
17861786
yarn lerna run types
17871787
- sanitize-verify-and-store-mocha-results:
1788-
expectedResultCount: 8
1788+
expectedResultCount: 7
17891789

17901790
verify-release-readiness:
17911791
<<: *defaults

guides/esm-migration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ When migrating some of these projects away from the `ts-node` entry [see `@packa
4747
- [ ] packages/extension
4848
- [ ] packages/frontend-shared **PARTIAL** - entry point is JS
4949
- [x] packages/electron ✅ **COMPLETED**
50-
- [ ] packages/https-proxy - higher priority
50+
- [x] packages/https-proxy - **COMPLETED**
5151
- [x] packages/icons ✅ **COMPLETED**
5252
- [x] packages/launcher ✅ **COMPLETED**
5353
- [x] packages/launchpad ✅ **COMPLETED**
@@ -96,7 +96,7 @@ When migrating some of these projects away from the `ts-node` entry [see `@packa
9696
- [x] packages/electron ✅ **COMPLETED**
9797
- [x] packages/error ✅ **COMPLETED**
9898
- [ ] packages/extension
99-
- [ ] packages/https-proxy
99+
- [x] packages/https-proxy**COMPLETED**
100100
- [x] packages/electron ✅ **COMPLETED**
101101
- [x] packages/icons ✅ **COMPLETED**
102102
- [x] packages/launcher ✅ **COMPLETED**

packages/driver/cypress/plugins/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const auth = require('basic-auth')
33
const bodyParser = require('body-parser')
44
const express = require('express')
55
const http = require('http')
6-
const httpsProxy = require('@packages/https-proxy')
6+
const { create: createHttpsServer } = require('@packages/https-proxy/test/helpers/https_server')
77
const path = require('path')
88
const Promise = require('bluebird')
99
const multer = require('multer')
@@ -377,7 +377,7 @@ const createApp = (port) => {
377377
})
378378

379379
app.get('/aut-commands', async (req, res) => {
380-
const script = (await fs.readFileAsync(path.join(__dirname, '..', 'fixtures', 'aut-commands.js'))).toString()
380+
const script = (await fs.readFile(path.join(__dirname, '..', 'fixtures', 'aut-commands.js'))).toString()
381381

382382
res.send(`
383383
<html>
@@ -411,7 +411,7 @@ httpPorts.forEach((port) => {
411411
// style to make sure we implement cookie handling correctly
412412
httpsPorts.forEach((port) => {
413413
const httpsApp = createApp(port)
414-
const httpsServer = httpsProxy.httpsServer(httpsApp)
414+
const httpsServer = createHttpsServer(httpsApp)
415415

416416
return httpsServer.listen(port, () => {
417417
// eslint-disable-next-line no-console

packages/https-proxy/.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cjs/
2+
esm/
3+
tsconfig.json

packages/https-proxy/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
ca/
2+
cjs/
3+
esm/

packages/https-proxy/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This package enables Cypress to inspect and modify bytes coming in and out of th
66

77
## Testing
88

9+
Since `vitest` runs specs in parallel by default, we get collisions in the `proxy.spec.ts` and `server.spec.ts` as there is a proxy server running in the background for `proxy.spec.ts` while we are testing the implements of `server.spec.ts`. These tests cannot run at the same time, hence why we leverage the `no-file-parallelism` option.
10+
911
```bash
1012
yarn workspace @packages/https-proxy test
1113
yarn workspace @packages/https-proxy test-watch

packages/https-proxy/https.js

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

packages/https-proxy/index.js

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

0 commit comments

Comments
 (0)