mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-01 20:19:58 -06:00
* feat: update to electron 25 and bump node dependencies. need to remove custom docker image * chore: update node versions to 18+ [run ci] * chore: bump @types/node from v16 to v18 and bump the typescript supported CLI version from 3.9 to 4.4 * update mock-fs to 5.2.0 to fix BigInt issue (see https://github.com/tschaub/mock-fs/releases/tag/v5.1.4) [run ci] * chore: update electron integrity check to pass create binary job * chore: fix issues with achrinza/node-ipc not yet having node 18 engine support (only up to 17 by patching from 9.2.2 to 9.2.5 as seen in https://github.com/achrinza/node-ipc/pull/38. vue/cli-service is not maintained and we should migrate these over to vue create at some point in the near future to get rid of these resolutions * allow for TLSv1 tests to work with node 18 as the express server running node 18 with tlsv1 needs to allow legacy ciphers * chore: update snyk workflows to use node 18 * chore: add changelog * update timeout * more cleanup during binary build * bump cache and run ci. include ignore engines for rwa and get rid of 16.16 image references * chore: update FF tests to 115 as serialization now works with errors and click events do not get fired on buttons being typed into * chore: don't error when symlink already exists * chore: fix serialization test for newer versions of firefox * chore: fix CI config * chore: fix chrome system tests to work with chrome 114. updates mostly caused by bugs in screen height in chrome. see https://bugs.chromium.org/p/chromium/issues/detail?id=1416398 * chore: test binary against vite update in RWA * remove wait for RWA as it shouldnt be needed for vite. link example recipes update to node 18 chore: remove commented out code * chore: print message when DISABLE_SNAPSHOT_REQUIRE is set * chore: clean out unneeded dependencies always * chore: remove trailing space * fix: propagate click events for enter and typing on firefox 106 or later * chore: fix changelog failures * fix: correctly simulate click events for buttons on keyup and space type in Firefox versions greater than 91 and simulate click for buttons on enter in Firefox versions greater than or equal to 106 * chore: add documentation to type to clarify firefox synthetic events * chore: update protocol snapshot as order or log messages seems to have changed * update comments * sort commandLogChanged events for protocol * chore: remove PR ids from CRA and CER as the PRs are merged into develop --------- Co-authored-by: Ryan Manuel <ryanm@cypress.io> Co-authored-by: Chris Breiding <chrisbreiding@gmail.com> Co-authored-by: Matt Schile <mschile@cypress.io>
188 lines
3.9 KiB
JavaScript
188 lines
3.9 KiB
JavaScript
const _ = require('lodash')
|
|
const chalk = require('chalk')
|
|
const minimist = require('minimist')
|
|
const cp = require('child_process')
|
|
|
|
const path = require('path')
|
|
const os = require('os')
|
|
|
|
const options = minimist(process.argv.slice(2))
|
|
|
|
let run = options._
|
|
|
|
if (options['spec']) {
|
|
console.error('NOTE: It is no longer necessary to pass `--spec` to server test commands. Try passing the path directly instead.')
|
|
run = [options.spec]
|
|
}
|
|
|
|
if (run[0] && run[0].includes('--inspect-brk')) {
|
|
run = run.slice(1)
|
|
}
|
|
|
|
if (options['glob-in-dir']) {
|
|
if (run[0]) {
|
|
run = [path.join(options['glob-in-dir'], '**', `*${run[0]}*`)]
|
|
} else {
|
|
run = [path.join(options['glob-in-dir'], '**')]
|
|
}
|
|
}
|
|
|
|
function exitErr (msg) {
|
|
console.error(chalk.red(msg))
|
|
|
|
return process.exit(1)
|
|
}
|
|
|
|
const isWindows = () => {
|
|
return os.platform() === 'win32'
|
|
}
|
|
|
|
const isGteNode12 = () => {
|
|
return Number(process.versions.node.split('.')[0]) >= 12
|
|
}
|
|
const isGteNode18 = () => {
|
|
return Number(process.versions.node.split('.')[0]) >= 18
|
|
}
|
|
|
|
if (!run || !run.length) {
|
|
return exitErr(`
|
|
Error: A path to a spec file or a pattern must be specified!
|
|
|
|
It should look something like this:
|
|
|
|
$ yarn test ./test/unit/api.cy.js
|
|
$ yarn test api_spec
|
|
`)
|
|
}
|
|
|
|
const commandAndArguments = {
|
|
command: '',
|
|
args: [],
|
|
}
|
|
|
|
if (isWindows()) {
|
|
commandAndArguments.command = 'mocha'
|
|
commandAndArguments.args = run.slice()
|
|
} else {
|
|
commandAndArguments.command = 'xvfb-maybe'
|
|
// this should always match cli/lib/exec/xvfb.js
|
|
commandAndArguments.args = [
|
|
`-as`,
|
|
`"-screen 0 1280x1024x24"`,
|
|
`--`,
|
|
'node',
|
|
]
|
|
}
|
|
|
|
if (options['inspect-brk']) {
|
|
commandAndArguments.args.push(
|
|
'--inspect',
|
|
`--inspect-brk${options['inspect-brk'] === true ? '' : `=${options['inspect-brk']}`}`,
|
|
)
|
|
}
|
|
|
|
if (isGteNode12()) {
|
|
// max HTTP header size 8kb -> 1mb
|
|
// https://github.com/cypress-io/cypress/issues/76
|
|
commandAndArguments.args.push(
|
|
`--max-http-header-size=${1024 * 1024}`,
|
|
)
|
|
}
|
|
|
|
// allow all ciphers to test TLSv1 in Node 18+ for express hosted servers in system tests
|
|
if (isGteNode18()) {
|
|
// https://github.com/nodejs/node/issues/49210
|
|
commandAndArguments.args.push(
|
|
`--tls-cipher-list=DEFAULT@SECLEVEL=0`,
|
|
)
|
|
}
|
|
|
|
if (!isWindows()) {
|
|
commandAndArguments.args.push(
|
|
'node_modules/.bin/_mocha',
|
|
)
|
|
|
|
commandAndArguments.args = commandAndArguments.args.concat(run)
|
|
}
|
|
|
|
if (options.fgrep) {
|
|
commandAndArguments.args.push(
|
|
'--fgrep',
|
|
options.fgrep,
|
|
)
|
|
}
|
|
|
|
const configFilePath = path.join(__dirname, 'mocha-reporter-config.json')
|
|
|
|
commandAndArguments.args.push(
|
|
'--timeout',
|
|
options['inspect-brk'] ? '40000000' : '10000',
|
|
'--recursive',
|
|
'-r @packages/ts/register',
|
|
'--reporter',
|
|
'mocha-multi-reporters',
|
|
'--reporter-options',
|
|
`configFile=${configFilePath}`,
|
|
'--extension=js,ts',
|
|
// restore mocha 2.x behavior to force end process after spec run
|
|
'--exit',
|
|
)
|
|
|
|
const env = _.clone(process.env)
|
|
|
|
env.NODE_ENV = 'test'
|
|
env.CYPRESS_INTERNAL_ENV = 'test'
|
|
|
|
if (env.VERBOSE === '1') {
|
|
_.extend(env, {
|
|
CYPRESS_DEBUG: true,
|
|
NODE_DEBUG: 'request',
|
|
BLUEBIRD_DEBUG: 1,
|
|
DEBUG: _.chain([
|
|
env.DEBUG,
|
|
'nock.*',
|
|
'-nock.common',
|
|
'-nock.scope',
|
|
'-nock.interceptor',
|
|
'socket.io:*',
|
|
'xvfb-maybe',
|
|
])
|
|
.compact()
|
|
.join(','),
|
|
})
|
|
}
|
|
|
|
if (options.browser) {
|
|
env.BROWSER = options.browser
|
|
}
|
|
|
|
if (options.headed) {
|
|
env.HEADED = true
|
|
}
|
|
|
|
if (options.exit === false) {
|
|
env.NO_EXIT = '1'
|
|
}
|
|
|
|
if (options['cypress-inspect-brk']) {
|
|
env.CYPRESS_INSPECT_BRK = '1'
|
|
}
|
|
|
|
const cmd = `${commandAndArguments.command} ${
|
|
commandAndArguments.args.join(' ')}`
|
|
|
|
console.log('cwd:', process.cwd())
|
|
console.log('specfiles:', run)
|
|
console.log('test command:')
|
|
console.log(cmd)
|
|
|
|
const child = cp.spawn(cmd, { shell: true, env, stdio: 'inherit' })
|
|
|
|
child.on('exit', (code, signal) => {
|
|
if (signal) {
|
|
console.error(`tests exited with signal ${signal}`)
|
|
}
|
|
|
|
process.exit(code === null ? 1 : code)
|
|
})
|