Files
cypress/cli/lib/index.ts
T
Bill Glesias 31ee30b6f3 chore: convert CLI tests to vitest (#32416)
* chore: rename snapshots and spec files to fit vitest convention (#32405)

* chore: move compiled files to dist directory to make vitest convertion easier (#32406)

* chore: convert utils to vitest (#32407)

* chore: convert logger to vitest

* chore: convert errors spec to vitest

* chore: convert cypress spec to vitest

* chore: convert `exec` directory to `vitest` (#32428)

* chore: cut over exec directory to vitest

* Update cli/test/lib/exec/run.spec.ts

* Update cli/test/lib/exec/run.spec.ts

* Update cli/test/lib/exec/run.spec.ts

* chore: convert the CLI and build script specs over to vitest (#32438)

* chore: convert tasks directory to vitest (#32434)

change way verify module is exported due to issues interpreting module (thinks its an esm)

rework scripts as we cannot run an empty mocha suite

chore: fix snapshots and verify requires that are internal to the cypress project

fix stubbing issues with fs-extra which is also used by request-progress under the hood

fix issues where xvfb was stopping prematurely

* chore: remove files no longer used now that mocha tests are converted to vitest (#32455)

* build binaries

* chore: fix CLI tests (#32484)

* chore: remove CI branch
2025-09-12 19:20:13 -04:00

47 lines
1.1 KiB
TypeScript

import minimist from 'minimist'
import debug from 'debug'
import util from './util'
import CLI from './cypress'
import installModule from './tasks/install'
import { start as verifyStart } from './tasks/verify'
const debugCli = debug('cypress:cli')
const args: any = minimist(process.argv.slice(2))
// we're being used from the command line
async function handleExec (): Promise<void> {
switch (args.exec) {
case 'install': {
debugCli('installing Cypress from NPM')
installModule.start({ force: args.force })
.catch(util.logErrorExit1)
break
}
case 'verify': {
// for simple testing in the monorepo
debugCli('verifying Cypress')
verifyStart({ force: true }) // always force verification
.catch(util.logErrorExit1)
break
}
default: {
break
}
}
}
// Execute the async function
if (args.exec) {
handleExec().catch(util.logErrorExit1)
} else {
debugCli('exporting Cypress module interface')
}
// this is how the module needs to be exported to avoid a breaking change
// default exports WILL BREAK in a CJS context through a require('cypress') call
export = CLI