mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-09 08:40:32 -06:00
Pass projectRoot and configFile to plugins file through config (#6317)
* decaffeinate: Rename index.coffee from .coffee to .js * decaffeinate: Convert index.coffee to JS * decaffeinate: Run post-processing cleanups on index.coffee * refactor decaffeinated plugins/index.js * decaffeinate: Rename 3_plugins_spec.coffee from .coffee to .js * decaffeinate: Convert 3_plugins_spec.coffee to JS * decaffeinate: Run post-processing cleanups on 3_plugins_spec.coffee * fix wrongly removed return * refactor e2e plugins spec, update snapshot * pass env argument to plugins file * decaffeinate: Rename index_spec.coffee from .coffee to .js * decaffeinate: Convert index_spec.coffee to JS * decaffeinate: Run post-processing cleanups on index_spec.coffee * update plugins tests * update scaffold snapshot * add back server test script and document running individual tests * add projectRoot and configFile directly to config * normalize browsers in snapshot * add types for configFile and projectRoot * fix linting issues * return return * Merge * remove file * remove unnecessary returns
This commit is contained in:
13
cli/types/index.d.ts
vendored
13
cli/types/index.d.ts
vendored
@@ -52,7 +52,7 @@ declare namespace Cypress {
|
||||
type RequestBody = string | object
|
||||
type ViewportOrientation = "portrait" | "landscape"
|
||||
type PrevSubject = "optional" | "element" | "document" | "window"
|
||||
type PluginConfig = (on: PluginEvents, config: ConfigOptions) => void | Partial<ConfigOptions> | Promise<Partial<ConfigOptions>>
|
||||
type PluginConfig = (on: PluginEvents, config: PluginConfigOptions) => void | Partial<ConfigOptions> | Promise<Partial<ConfigOptions>>
|
||||
|
||||
interface CommandOptions {
|
||||
prevSubject: boolean | PrevSubject | PrevSubject[]
|
||||
@@ -2282,6 +2282,17 @@ declare namespace Cypress {
|
||||
firefoxGcInterval: Nullable<number | { runMode: Nullable<number>, openMode: Nullable<number> }>
|
||||
}
|
||||
|
||||
interface PluginConfigOptions extends ConfigOptions {
|
||||
/**
|
||||
* Absolute path to the config file (default: <projectRoot>/cypress.json) or false
|
||||
*/
|
||||
configFile: string | false
|
||||
/**
|
||||
* Absolute path to the root of the project
|
||||
*/
|
||||
projectRoot: string
|
||||
}
|
||||
|
||||
interface DebugOptions {
|
||||
verbose: boolean
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ const pluginConfig: Cypress.PluginConfig = (on, config) => {}
|
||||
|
||||
// allows synchronous returns
|
||||
const pluginConfig2: Cypress.PluginConfig = (on, config) => {
|
||||
config // $ExpectType ConfigOptions
|
||||
config // $ExpectType PluginConfigOptions
|
||||
config.baseUrl // $ExpectType: string
|
||||
config.configFile // $ExpectType: string | false
|
||||
config.projectRoot // $ExpectType: string
|
||||
|
||||
on('before:browser:launch', (browser, options) => {
|
||||
browser.displayName // $ExpectType string
|
||||
|
||||
Reference in New Issue
Block a user