Skip to content

Commit

Permalink
fix: for browsers field, fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser committed Feb 28, 2022
1 parent 2e40041 commit ce158b0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
18 changes: 10 additions & 8 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2908,6 +2908,10 @@ declare namespace Cypress {
* Options appended to config object on runtime.
*/
interface RuntimeConfigOptions extends Partial<RuntimeServerConfigOptions> {
/**
* Absolute path to the config file (default: <projectRoot>/cypress.config.{ts|js}) or false
*/
configFile: string | false
/**
* CPU architecture, from Node `os.arch()`
*
Expand Down Expand Up @@ -2941,10 +2945,15 @@ declare namespace Cypress {
* The Cypress version being used.
*/
version: string

// Internal or Unlisted at server/lib/config_options
namespace: string
projectRoot: string
devServerPublicPathRoute: string
}

/**
* Options appended before the server starts
* Optional options added before the server starts
*/
interface RuntimeServerConfigOptions {
/**
Expand All @@ -2956,15 +2965,12 @@ declare namespace Cypress {
browserUrl: string
clientRoute: string
cypressEnv: string
devServerPublicPathRoute: string
isNewProject: boolean
isTextTerminal: boolean
morgan: boolean
namespace: string
parentTestsFolder: string
parentTestsFolderDisplay: string
projectName: string
projectRoot: string
proxyUrl: string
remote: RemoteState
report: boolean
Expand Down Expand Up @@ -3002,10 +3008,6 @@ declare namespace Cypress {
type ConfigOptions<ComponentDevServerOpts = any> = Partial<ResolvedConfigOptions<ComponentDevServerOpts>>

interface PluginConfigOptions extends ResolvedConfigOptions, RuntimeConfigOptions {
/**
* Absolute path to the config file (default: <projectRoot>/cypress.config.{ts|js}) or false
*/
configFile: string | false
/**
* Absolute path to the root of the project
*/
Expand Down
21 changes: 10 additions & 11 deletions cli/types/tests/plugins-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ const pluginConfig: Cypress.PluginConfig = (on, config) => {}
// allows synchronous returns
const pluginConfig2: Cypress.PluginConfig = (on, config) => {
config // $ExpectType PluginConfigOptions
config.baseUrl // $ExpectType: string
config.configFile // $ExpectType: string | false
config.fixturesFolder // $ExpectType: string | false
config.pluginsFile // $ExpectType: string | false
config.screenshotsFolder // $ExpectType: string | false
config.videoCompression // $ExpectType: number | false
config.projectRoot // $ExpectType: string
config.version // $ExpectType: string
config.testingType // $ExpectType: TestingType

config.browsers // $ExpectType: false
config.baseUrl // $ExpectType string | null
config.configFile // $ExpectType string | false
config.fixturesFolder // $ExpectType string | false
config.pluginsFile // $ExpectType string | false
config.screenshotsFolder // $ExpectType string | false
config.videoCompression // $ExpectType number | false
config.projectRoot // $ExpectType string
config.version // $ExpectType string
config.testingType // $ExpectType TestingType
config.browsers // $ExpectType Browser[]

on('before:browser:launch', (browser, options) => {
browser.displayName // $ExpectType string
Expand Down

0 comments on commit ce158b0

Please sign in to comment.