Skip to content

Commit

Permalink
fix: run-ct does not hang on windows anymore (#16022)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barthélémy Ledoux authored Apr 16, 2021
1 parent df789cc commit 6c12a6c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
1 change: 1 addition & 0 deletions npm/webpack-dev-server/src/startServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export async function start ({ webpackConfig: userWebpackConfig, options, ...use
hot: false,
inline: false,
publicPath: devServerPublicPathRoute,
noInfo: true,
}

return new WebpackDevServer(compiler, webpackDevServerConfig)
Expand Down
5 changes: 4 additions & 1 deletion packages/server-ct/src/socket-ct.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Debug from 'debug'
import * as socketIo from '@packages/socket'
import devServer from '@packages/server/lib/plugins/dev-server'
import { SocketBase } from '@packages/server/lib/socket-base'
import { DestroyableHttpServer } from '@packages/server/lib/util/server_destroy'

const debug = Debug('cypress:server-ct:socket-ct')

export class SocketCt extends SocketBase {
constructor (config: Record<string, any>) {
super(config)
Expand All @@ -26,7 +29,7 @@ export class SocketCt extends SocketBase {

return super.startListening(server, automation, config, options, {
onSocketConnection (socket: socketIo.SocketIOServer) {

debug('do onSocketConnection')
},
})
}
Expand Down
11 changes: 9 additions & 2 deletions packages/server/lib/project-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export type Cfg = Record<string, any>

const localCwd = cwd()
const multipleForwardSlashesRe = /[^:\/\/](\/{2,})/g
const backSlashesRe = /\\/g

const debug = Debug('cypress:server:project')
const debugScaffold = Debug('cypress:server:scaffold')
Expand Down Expand Up @@ -373,6 +374,7 @@ export class ProjectBase<TServer extends ServerE2E | ServerCt> extends EE {
},

onConnect: (id) => {
debug('socket:connected')
this.emit('socket:connected', id)
},

Expand Down Expand Up @@ -574,10 +576,14 @@ export class ProjectBase<TServer extends ServerE2E | ServerCt> extends EE {

const folderToUse = type === 'integration' ? integrationFolder : componentFolder

// To avoid having invalid urls from containing backslashes,
// we normalize specUrls to posix by replacing backslash by slash
// Indeed, path.realtive will return something different on windows
// than on posix systems which can lead to problems
const url = `/${path.join(type, path.relative(
folderToUse,
path.resolve(projectRoot, pathToSpec),
))}`
)).replace(backSlashesRe, '/')}`

debug('prefixed path for spec %o', { pathToSpec, type, url })

Expand All @@ -591,7 +597,8 @@ export class ProjectBase<TServer extends ServerE2E | ServerCt> extends EE {
browserUrl,
'#/tests',
escapeFilenameInUrl(specUrl),
].join('/').replace(multipleForwardSlashesRe, replacer)
].join('/')
.replace(multipleForwardSlashesRe, replacer)
}

scaffold (cfg: Cfg) {
Expand Down
2 changes: 2 additions & 0 deletions packages/server/lib/server-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ export class ServerE2E extends ServerBase<SocketE2E> {
}
}

debug('createServer connecting to server')

this.server.on('connect', this.onConnect.bind(this))
this.server.on('upgrade', (req, socket, head) => this.onUpgrade(req, socket, head, socketIoRoute))
this.server.once('error', onError)
Expand Down
21 changes: 2 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16322,7 +16322,7 @@ detect-node@^2.0.4:
resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c"
integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==

detect-port-alt@1.1.6, detect-port-alt@^1.1.6:
detect-port-alt@1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/detect-port-alt/-/detect-port-alt-1.1.6.tgz#24707deabe932d4a3cf621302027c2b266568275"
integrity sha512-5tQykt+LqfJFBEYaDITx7S7cR7mJ/zQmLXZ2qt5w04ainYZw6tBf9dBunMjVeVOdYVRUzUOE4HkY5J7+uttb5Q==
Expand Down Expand Up @@ -36453,23 +36453,6 @@ superagent@^3.8.3:
qs "^6.5.1"
readable-stream "^2.3.5"

superagent@^5.1.0:
version "5.3.1"
resolved "https://registry.yarnpkg.com/superagent/-/superagent-5.3.1.tgz#d62f3234d76b8138c1320e90fa83dc1850ccabf1"
integrity sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==
dependencies:
component-emitter "^1.3.0"
cookiejar "^2.1.2"
debug "^4.1.1"
fast-safe-stringify "^2.0.7"
form-data "^3.0.0"
formidable "^1.2.2"
methods "^1.1.2"
mime "^2.4.6"
qs "^6.9.4"
readable-stream "^3.6.0"
semver "^7.3.2"

supertest-session@4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/supertest-session/-/supertest-session-4.0.0.tgz#3b442cbc37ede15a4acf7f8c570b836d880f8a40"
Expand Down Expand Up @@ -39663,7 +39646,7 @@ webpack-virtual-modules@^0.2.2:
dependencies:
debug "^3.0.0"

webpack@4, webpack@^4.0.0, webpack@^4.18.1, webpack@^4.35.3, webpack@^4.44.1, webpack@^4.44.2:
webpack@4, webpack@^4.0.0, webpack@^4.18.1, webpack@^4.44.1, webpack@^4.44.2:
version "4.46.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.46.0.tgz#bf9b4404ea20a073605e0a011d188d77cb6ad542"
integrity sha512-6jJuJjg8znb/xRItk7bkT0+Q7AHCYjjFnvKIWQPkNIOyRqoCGvkOs0ipeQzrqz4l5FtN5ZI/ukEHroeX/o1/5Q==
Expand Down

2 comments on commit 6c12a6c

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 6c12a6c Apr 16, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.2.0/appveyor-develop-6c12a6c7b706ee4f708a9d19c62f18cd0838a433/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 6c12a6c Apr 16, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.2.0/appveyor-develop-6c12a6c7b706ee4f708a9d19c62f18cd0838a433/cypress.tgz

Please sign in to comment.