mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-05 14:30:32 -05:00
feat: Use .config files (#18578)
Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
This commit is contained in:
committed by
GitHub
parent
469b228cde
commit
081dd19cc6
@@ -21,19 +21,21 @@ exports['shows help for open --foo 1'] = `
|
||||
--component runs component tests
|
||||
-c, --config <config> sets configuration values. separate multiple
|
||||
values with a comma. overrides any value in
|
||||
cypress.json.
|
||||
cypress.config.{ts|js}.
|
||||
-C, --config-file <config-file> path to JSON file where configuration values
|
||||
are set. defaults to "cypress.json". pass
|
||||
"false" to disable.
|
||||
are set. defaults to
|
||||
"cypress.config.{ts|js}". pass "false" to
|
||||
disable.
|
||||
-d, --detached [bool] runs Cypress application in detached mode
|
||||
--e2e runs end to end tests
|
||||
-e, --env <env> sets environment variables. separate
|
||||
multiple values with a comma. overrides any
|
||||
value in cypress.json or cypress.env.json
|
||||
value in cypress.config.{ts|js} or
|
||||
cypress.env.json
|
||||
--global force Cypress into global mode as if its
|
||||
globally installed
|
||||
-p, --port <port> runs Cypress on a specific port. overrides
|
||||
any value in cypress.json.
|
||||
any value in cypress.config.{ts|js}.
|
||||
-P, --project <project-path> path to the project
|
||||
--dev runs cypress in development and bypasses
|
||||
binary check
|
||||
@@ -67,17 +69,17 @@ exports['shows help for run --foo 1'] = `
|
||||
-b, --browser <browser-name-or-path> runs Cypress in the browser with the given name. if a filesystem path is supplied, Cypress will attempt to use the browser at that path.
|
||||
--ci-build-id <id> the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers
|
||||
--component runs component tests
|
||||
-c, --config <config> sets configuration values. separate multiple values with a comma. overrides any value in cypress.json.
|
||||
-C, --config-file <config-file> path to JSON file where configuration values are set. defaults to "cypress.json". pass "false" to disable.
|
||||
-c, --config <config> sets configuration values. separate multiple values with a comma. overrides any value in cypress.config.{ts|js}.
|
||||
-C, --config-file <config-file> path to JSON file where configuration values are set. defaults to "cypress.config.{ts|js}". pass "false" to disable.
|
||||
--e2e runs end to end tests
|
||||
-e, --env <env> sets environment variables. separate multiple values with a comma. overrides any value in cypress.json or cypress.env.json
|
||||
-e, --env <env> sets environment variables. separate multiple values with a comma. overrides any value in cypress.config.{ts|js} or cypress.env.json
|
||||
--group <name> a named group for recorded runs in the Cypress Dashboard
|
||||
-k, --key <record-key> your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.
|
||||
--headed displays the browser instead of running headlessly
|
||||
--headless hide the browser instead of running headed (default for cypress run)
|
||||
--no-exit keep the browser open after tests finish
|
||||
--parallel enables concurrent runs and automatic load balancing of specs across multiple machines or processes
|
||||
-p, --port <port> runs Cypress on a specific port. overrides any value in cypress.json.
|
||||
-p, --port <port> runs Cypress on a specific port. overrides any value in cypress.config.{ts|js}.
|
||||
-P, --project <project-path> path to the project
|
||||
-q, --quiet run quietly, using only the configured reporter
|
||||
--record [bool] records the run. sends test results, screenshots and videos to your Cypress Dashboard.
|
||||
|
||||
+4
-4
@@ -107,12 +107,12 @@ const descriptions = {
|
||||
cacheSize: 'Used with the list command to show the sizes of the cached folders',
|
||||
ciBuildId: 'the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers',
|
||||
component: 'runs component tests',
|
||||
config: 'sets configuration values. separate multiple values with a comma. overrides any value in cypress.json.',
|
||||
configFile: 'path to JSON file where configuration values are set. defaults to "cypress.json". pass "false" to disable.',
|
||||
config: 'sets configuration values. separate multiple values with a comma. overrides any value in cypress.config.{ts|js}.',
|
||||
configFile: 'path to JSON file where configuration values are set. defaults to "cypress.config.{ts|js}". pass "false" to disable.',
|
||||
detached: 'runs Cypress application in detached mode',
|
||||
dev: 'runs cypress in development and bypasses binary check',
|
||||
e2e: 'runs end to end tests',
|
||||
env: 'sets environment variables. separate multiple values with a comma. overrides any value in cypress.json or cypress.env.json',
|
||||
env: 'sets environment variables. separate multiple values with a comma. overrides any value in cypress.config.{ts|js} or cypress.env.json',
|
||||
exit: 'keep the browser open after tests finish',
|
||||
forceInstall: 'force install the Cypress binary',
|
||||
global: 'force Cypress into global mode as if its globally installed',
|
||||
@@ -121,7 +121,7 @@ const descriptions = {
|
||||
headless: 'hide the browser instead of running headed (default for cypress run)',
|
||||
key: 'your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.',
|
||||
parallel: 'enables concurrent runs and automatic load balancing of specs across multiple machines or processes',
|
||||
port: 'runs Cypress on a specific port. overrides any value in cypress.json.',
|
||||
port: 'runs Cypress on a specific port. overrides any value in cypress.config.{ts|js}.',
|
||||
project: 'path to the project',
|
||||
quiet: 'run quietly, using only the configured reporter',
|
||||
record: 'records the run. sends test results, screenshots and videos to your Cypress Dashboard.',
|
||||
|
||||
@@ -282,7 +282,7 @@
|
||||
"includeShadowDom": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Enables including elements within the shadow DOM when using querying commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.json, per-suite or per-test in the test configuration object, or programmatically with Cypress.config()"
|
||||
"description": "Enables including elements within the shadow DOM when using querying commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.config.{ts|js}, per-suite or per-test in the test configuration object, or programmatically with Cypress.config()"
|
||||
},
|
||||
"clientCertificates": {
|
||||
"description": "Defines client certificates to use when sending requests to the specified URLs",
|
||||
|
||||
@@ -234,12 +234,12 @@ describe('cypress', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('coerces --config-file cypress.json to string', async () => {
|
||||
const args = 'cypress run --config-file cypress.json'.split(' ')
|
||||
it('coerces --config-file cypress.config.js to string', async () => {
|
||||
const args = 'cypress run --config-file cypress.config.js'.split(' ')
|
||||
const options = await cypress.cli.parseRunArguments(args)
|
||||
|
||||
expect(options).to.deep.equal({
|
||||
configFile: 'cypress.json',
|
||||
configFile: 'cypress.config.js',
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ describe('exec open', function () {
|
||||
})
|
||||
|
||||
it('spawns with --config-file set', function () {
|
||||
return open.start({ configFile: 'special-cypress.json' })
|
||||
return open.start({ configFile: 'special-cypress.config.js' })
|
||||
.then(() => {
|
||||
expect(spawn.start).to.be.calledWith(
|
||||
['--config-file', 'special-cypress.json'],
|
||||
['--config-file', 'special-cypress.config.js'],
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -150,10 +150,10 @@ describe('exec run', function () {
|
||||
})
|
||||
|
||||
it('spawns with --config-file set', function () {
|
||||
return run.start({ configFile: 'special-cypress.json' })
|
||||
return run.start({ configFile: 'special-cypress.config.js' })
|
||||
.then(() => {
|
||||
expect(spawn.start).to.be.calledWith(
|
||||
['--run-project', process.cwd(), '--config-file', 'special-cypress.json'],
|
||||
['--run-project', process.cwd(), '--config-file', 'special-cypress.config.js'],
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Vendored
+1
-1
@@ -144,7 +144,7 @@ declare namespace CypressCommandLine {
|
||||
*
|
||||
* If `false` is passed, no config file will be used.
|
||||
*
|
||||
* @default "cypress.json"
|
||||
* @default "cypress.config.{ts|js}"
|
||||
*/
|
||||
configFile: string | false
|
||||
/**
|
||||
|
||||
Vendored
+4
-4
@@ -353,7 +353,7 @@ declare namespace Cypress {
|
||||
|
||||
// no real way to type without generics
|
||||
/**
|
||||
* Returns all environment variables set with CYPRESS_ prefix or in "env" object in "cypress.json"
|
||||
* Returns all environment variables set with CYPRESS_ prefix or in "env" object in "cypress.config.{ts|js}"
|
||||
*
|
||||
* @see https://on.cypress.io/env
|
||||
*/
|
||||
@@ -362,7 +362,7 @@ declare namespace Cypress {
|
||||
* Returns specific environment variable or undefined
|
||||
* @see https://on.cypress.io/env
|
||||
* @example
|
||||
* // cypress.json
|
||||
* // cypress.config.js
|
||||
* { "env": { "foo": "bar" } }
|
||||
* Cypress.env("foo") // => bar
|
||||
*/
|
||||
@@ -2756,7 +2756,7 @@ declare namespace Cypress {
|
||||
retries: Nullable<number | { runMode?: Nullable<number>, openMode?: Nullable<number> }>
|
||||
/**
|
||||
* Enables including elements within the shadow DOM when using querying
|
||||
* commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.json,
|
||||
* commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.config.{ts|js},
|
||||
* per-suite or per-test in the test configuration object, or programmatically
|
||||
* with Cypress.config()
|
||||
* @default false
|
||||
@@ -2894,7 +2894,7 @@ declare namespace Cypress {
|
||||
|
||||
interface PluginConfigOptions extends ResolvedConfigOptions {
|
||||
/**
|
||||
* Absolute path to the config file (default: <projectRoot>/cypress.json) or false
|
||||
* Absolute path to the config file (default: <projectRoot>/cypress.config.{ts|js}) or false
|
||||
*/
|
||||
configFile: string | false
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user