Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
95452bf
bump node types
brian-mann Sep 2, 2025
95d540d
add network tests to terminals
brian-mann Sep 2, 2025
baa966f
dont use the web-config, just use regular TS so that it compiles much…
brian-mann Sep 2, 2025
ebbb79b
fix missing promise
brian-mann Sep 2, 2025
b55813b
cache families to include host + port; fix types
brian-mann Sep 2, 2025
3574ba5
fix incorrect cacheKey
brian-mann Sep 2, 2025
4685266
fix skipped tests and updated error messages likely due to node upgrade
brian-mann Sep 3, 2025
71bc6db
cleanup a ton of test context
brian-mann Sep 3, 2025
d63bdcb
Merge branch 'develop' into bmann/fix-proxy-cached-net-connect-port
jennifer-shehane Sep 3, 2025
d94cd64
Add changelog entry
jennifer-shehane Sep 3, 2025
338139b
close servers after each test
brian-mann Sep 3, 2025
f06a798
Merge branch 'bmann/fix-proxy-cached-net-connect-port' of https://git…
brian-mann Sep 3, 2025
1c70f66
Update packages/network/lib/agent.ts
brian-mann Sep 3, 2025
ac60eba
update tests to pass inside + outside of docker
brian-mann Sep 3, 2025
39f8125
Merge branch 'bmann/fix-proxy-cached-net-connect-port' of https://git…
brian-mann Sep 3, 2025
21fdf72
try this in docker
brian-mann Sep 3, 2025
1f3998c
try to enable ipv6 in circleci docker config
brian-mann Sep 3, 2025
9ba5c4e
escape
brian-mann Sep 3, 2025
384b6f5
dont run this test in CI
brian-mann Sep 3, 2025
414ef81
revert
brian-mann Sep 3, 2025
913224a
skip the other test
brian-mann Sep 3, 2025
f48b046
maybe this works
brian-mann Sep 3, 2025
eaaea2b
try this
ryanthemanuel Sep 3, 2025
f922c65
Update .circleci/workflows.yml
ryanthemanuel Sep 3, 2025
be77be1
oops
ryanthemanuel Sep 3, 2025
beadcc0
i do not think we need sudo
ryanthemanuel Sep 3, 2025
27ddf3d
test
ryanthemanuel Sep 3, 2025
697e923
test
ryanthemanuel Sep 3, 2025
7a70d39
try machine
ryanthemanuel Sep 3, 2025
bd2a1ba
refactor
ryanthemanuel Sep 3, 2025
842bbdc
that was weird
ryanthemanuel Sep 4, 2025
47cf7eb
that was weird
ryanthemanuel Sep 4, 2025
3e8dcd5
mess with daemon and sudo
ryanthemanuel Sep 4, 2025
90e58b5
escape <
ryanthemanuel Sep 4, 2025
e855b08
modify /etc/hosts
ryanthemanuel Sep 4, 2025
2d1146a
Update .circleci/workflows.yml
ryanthemanuel Sep 4, 2025
cee0ce3
Update .circleci/workflows.yml
ryanthemanuel Sep 4, 2025
37ad6b5
Update .circleci/workflows.yml
ryanthemanuel Sep 4, 2025
246c107
remove dead code
brian-mann Sep 4, 2025
5c733d8
Merge branch 'bmann/fix-proxy-cached-net-connect-port' of https://git…
brian-mann Sep 4, 2025
a69d7a5
Update branch condition in CircleCI workflow
ryanthemanuel Sep 4, 2025
84ead62
Update .circleci/workflows.yml
ryanthemanuel Sep 4, 2025
dd56f48
clean up
ryanthemanuel Sep 4, 2025
8fc1404
clean up
ryanthemanuel Sep 4, 2025
62d382f
fix cy in cy tests
ryanthemanuel Sep 4, 2025
34b4ad8
fix cy in cy
ryanthemanuel Sep 4, 2025
edf2292
Update packages/server/lib/server-base.ts
ryanthemanuel Sep 4, 2025
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
42 changes: 37 additions & 5 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ executors:
PLATFORM: linux
# TODO: Disabling snapshots for now on Linux Arm 64 architectures. Will revisit with https://github.com/cypress-io/cypress/issues/23557
DISABLE_SNAPSHOT_REQUIRE: 1
linux-x64: &linux-x64-executor
machine:
image: ubuntu-2004:2024.11.1
resource_class: medium
environment:
PLATFORM: linux

commands:
# This command inserts SHOULD_PERSIST_ARTIFACTS into BASH_ENV. This way, we can define the variable in one place and use it in multiple steps.
Expand Down Expand Up @@ -1791,11 +1797,36 @@ jobs:
condition:
equal: [ *windows-executor, << parameters.executor >> ]
steps:
- run: yarn test-scripts
# run unit tests from each individual package
- run: yarn test
# run type checking for each individual package
- run: yarn lerna run types
- run:
name: Enable IPv6 in Docker
command: |
cat \<<'EOF' | sudo tee /etc/docker/daemon.json
{
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"
}
EOF
cat \<<'EOF' | sudo tee /etc/hosts
127.0.0.1 localhost
::1 localhost
EOF
sudo service docker restart
- run:
name: Test scripts
command: |
source ./scripts/ensure-node.sh
yarn test-scripts
- run:
name: Test each individual package
command: |
source ./scripts/ensure-node.sh
# this is needed since we are have to be running as root to test some packages
sudo -E env "PATH=$PATH" yarn test
- run:
name: Test types
command: |
source ./scripts/ensure-node.sh
yarn lerna run types
- sanitize-verify-and-store-mocha-results:
expectedResultCount: 20

Expand Down Expand Up @@ -2908,6 +2939,7 @@ linux-x64-workflow: &linux-x64-workflow
requires:
- build
- unit-tests:
executor: linux-x64
requires:
- build
- verify-release-readiness:
Expand Down
7 changes: 7 additions & 0 deletions .vscode/terminals.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@
"onlySingle": true,
"cwd": "[cwd]/packages/driver",
"command": "yarn cypress:open"
},
{
"name": "packages/network test",
"focus": true,
"onlySingle": true,
"cwd": "[cwd]/packages/network",
"command": "yarn test-watch [file]"
}
]
}
6 changes: 5 additions & 1 deletion cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 15.1.1

_Released 09/16/2025 (PENDING)_
_Released 9/9/2025 (PENDING)_

**Bugfixes:**

- We now properly partition the `host` with `port` when caching family DNS lookups. This resolves issues where some `localhost` URLs were not resolving in `cy.visit()` in Cypress when they should have. Fixes [#25397](https://github.com/cypress-io/cypress/issues/25397). Addressed in [#32403](https://github.com/cypress-io/cypress/pull/32403).

**Dependency Updates:**

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"@types/lodash": "^4.14.168",
"@types/markdown-it": "12.2.3",
"@types/mocha": "8.0.3",
"@types/node": "20.16.0",
"@types/node": "22.15.1",
"@types/prismjs": "1.16.0",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/network/.mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
'test/unit/**/*.ts',
'test/integration/**/*.ts'
],
require: '../web-config/node-register',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think there are probably lots of other places where we're incorrectly requiring "web-config" in purely node based tests like this

require: '@packages/ts/register',
timeout: 10000,
recursive: true
}
}
18 changes: 10 additions & 8 deletions packages/network/lib/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,17 @@ export const regenerateRequestHead = (req: http.ClientRequest) => {
}
}

const getFirstWorkingFamily = (
{ port, host }: http.RequestOptions,
export const getFirstWorkingFamily = (
{ port, host }: Pick<http.RequestOptions, 'port' | 'host'>,
familyCache: FamilyCache,
cb: Function,
cb: (family?: net.family) => void,
) => {
// this is a workaround for localhost (and potentially others) having invalid
// A records but valid AAAA records. here, we just cache the family of the first
// returned A/AAAA record for a host that we can establish a connection to.
// https://github.com/cypress-io/cypress/issues/112

const isIP = net.isIP(host)
const isIP = net.isIP(host) as net.family | 0

if (isIP) {
// isIP conveniently returns the family of the address
Expand All @@ -170,13 +170,15 @@ const getFirstWorkingFamily = (
return cb()
}

if (familyCache[host]) {
return cb(familyCache[host])
const cacheKey = `${host}:${port}`

if (familyCache[cacheKey]) {
return cb(familyCache[cacheKey])
}

return getAddress(port, host)
.then((firstWorkingAddress: net.Address) => {
familyCache[host] = firstWorkingAddress.family
familyCache[cacheKey] = firstWorkingAddress.family

return cb(firstWorkingAddress.family)
})
Expand Down Expand Up @@ -246,7 +248,7 @@ export class CombinedAgent {

debug('addRequest called %o', { isHttps, ..._.pick(options, 'href') })

return getFirstWorkingFamily(options, this.familyCache, (family: net.family) => {
return getFirstWorkingFamily(options, this.familyCache, (family?: net.family) => {
options.family = family

debug('got family %o', _.pick(options, 'family', 'href'))
Expand Down
20 changes: 15 additions & 5 deletions packages/network/test/integration/connect_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ describe('lib/connect', function () {
const server = net.createServer(_.partialRight(_.invoke, 'close'))

return Bluebird.fromCallback((cb) => {
server.listen(0, '127.0.0.1', cb)
server.listen({
port: 0,
host: '127.0.0.1',
}, cb.bind(server))
})
.then(() => {
return connect.getAddress(server.address().port, 'localhost')
Expand All @@ -31,19 +34,24 @@ describe('lib/connect', function () {
})
})
.then(() => {
server.close()
return Bluebird.fromCallback((cb) => {
server.close(cb)
})
})
})

// Error: listen EADDRNOTAVAIL ::1
// NOTE: add an ipv6 lo if to the docker container
it.skip('resolves localhost on ::1 immediately', function () {
it('resolves localhost on ::1 immediately', function () {
this.timeout(50)

const server = net.createServer(_.partialRight(_.invoke, 'close'))

return Bluebird.fromCallback((cb) => {
server.listen(0, '::1', cb)
server.listen({
port: 0,
host: '::1',
}, cb.bind(server))
})
.then(() => {
return connect.getAddress(server.address().port, 'localhost')
Expand All @@ -55,7 +63,9 @@ describe('lib/connect', function () {
})
})
.then(() => {
server.close()
return Bluebird.fromCallback((cb) => {
server.close(cb)
})
})
})
})
Expand Down
Loading
Loading