Skip to content

Commit

Permalink
feat: add defineConfig function to help type config (#18302)
Browse files Browse the repository at this point in the history
Co-authored-by: Zach Bloomquist <github@chary.us>
  • Loading branch information
elevatebart and flotwig authored Oct 5, 2021
1 parent 6fc9468 commit 7cca9b7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
17 changes: 17 additions & 0 deletions cli/lib/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@ const cypressModuleApi = {
return cli.parseRunCommand(args)
},
},

/**
* Provides automatic code completion for configuration in many popular code editors.
* While it's not strictly necessary for Cypress to parse your configuration, we
* recommend wrapping your config object with `defineConfig()`
* @example
* module.exports = defineConfig({
* viewportWith: 400
* })
*
* @see ../types/cypress-npm-api.d.ts
* @param {Cypress.ConfigOptions} config
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
*/
defineConfig (config) {
return config
},
}

module.exports = cypressModuleApi
15 changes: 15 additions & 0 deletions cli/types/cypress-npm-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,21 @@ declare module 'cypress' {
* Cypress does
*/
cli: CypressCommandLine.CypressCliParser

/**
* Provides automatic code completion for configuration in many popular code editors.
* While it's not strictly necessary for Cypress to parse your configuration, we
* recommend wrapping your config object with `defineConfig()`
* @example
* module.exports = defineConfig({
* viewportWith: 400
* })
*
* @see ../types/cypress-npm-api.d.ts
* @param {Cypress.ConfigOptions} config
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
*/
defineConfig(config: Cypress.ConfigOptions): Cypress.ConfigOptions
}

// export Cypress NPM module interface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module.exports = {
const { defineConfig } = require('cypress')

module.exports = defineConfig({
pageLoadTimeout: 10000,
e2e: {
defaultCommandTimeout: 500,
videoCompression: 20,
},
}
})

4 comments on commit 7cca9b7

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7cca9b7 Oct 5, 2021

Choose a reason for hiding this comment

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

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.6.0/circle-develop-7cca9b713af5eace0c9de629943b033416b0950b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7cca9b7 Oct 5, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.6.0/appveyor-develop-7cca9b713af5eace0c9de629943b033416b0950b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7cca9b7 Oct 5, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.6.0/appveyor-develop-7cca9b713af5eace0c9de629943b033416b0950b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7cca9b7 Oct 5, 2021

Choose a reason for hiding this comment

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

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.6.0/circle-develop-7cca9b713af5eace0c9de629943b033416b0950b/cypress.tgz

Please sign in to comment.