Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Added types for runtime config. #14584

Merged
merged 3 commits into from
Jan 20, 2021
Merged
Changes from all commits
Commits
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
106 changes: 105 additions & 1 deletion cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ declare namespace Cypress {
// {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ...}
```
*/
config(): ResolvedConfigOptions
config(): ResolvedConfigOptions & RuntimeConfigOptions
/**
* Returns one configuration value.
* @see https://on.cypress.io/config
Expand Down Expand Up @@ -2609,6 +2609,110 @@ declare namespace Cypress {
includeShadowDom: boolean
}

/**
* Options appended to config object on runtime.
*/
interface RuntimeConfigOptions {
/**
* CPU architecture, from Node `os.arch()`
*
* @see https://nodejs.org/api/os.html#os_os_arch
*/
arch: string
/**
* The list of hosts to be blocked
*/
blockHosts: null | string | string[]
/**
* The browser Cypress is running on.
*/
browser: Browser
/**
* Available browsers found on your system.
*/
browsers: Browser[]
/**
* Path to folder containing component test files.
*/
componentFolder: string
/**
* Whether component testing is enabled.
*/
experimentalComponentTesting: boolean
/**
* Hosts mappings to IP addresses.
*/
hosts: null | string[]
/**
* Whether Cypress was launched via 'cypress open' (interactive mode)
*/
isInteractive: boolean
/**
* Whether Cypress will search for and replace
* obstructive JS code in .js or .html files.
*
* @see https://on.cypress.io/configuration#modifyObstructiveCode
*/
modifyObstructiveCode: boolean
/**
* The platform Cypress is running on.
*/
platform: 'linux' | 'darwin' | 'win32'
/**
* A unique ID for the project used for recording
*/
projectId: null | string
/**
* Path to the support folder.
*/
supportFolder: string
/**
* Glob pattern to determine what test files to load.
*/
testFiles: string
/**
* The user agent the browser sends in all request headers.
*/
userAgent: null | string
/**
* The Cypress version being used.
*/
version: string

// Internal or Unlisted at server/lib/config_options
autoOpen: boolean
browserUrl: string
clientRoute: string
configFile: string
cypressEnv: string
integrationExampleName: string
integrationExamplePath: string
isNewProject: boolean
isTextTerminal: boolean
morgan: boolean
namespace: string
parentTestsFolder: string
parentTestsFolderDisplay: string
projectName: string
projectRoot: string
proxyUrl: string
report: boolean
reporterRoute: string
reporterUrl: string
socketId: null | string
socketIoCookie: string
socketIoRoute: string
spec: {
Copy link
Member

Choose a reason for hiding this comment

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

I could see this also being useful to document.

absolute: string
name: string
relative: string
specFilter: null | string
specType: 'integration' | 'component'
}
xhrRoute: string
xhrUrl: string
}

interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'animationDistanceThreshold' | 'baseUrl' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>> {
browser?: IsBrowserMatcher | IsBrowserMatcher[]
}
Expand Down