Skip to content

Commit

Permalink
types: add failures and message to npm module result (#5337)
Browse files Browse the repository at this point in the history
* types: add failures and message to npm module result

* remove memberof in comments
  • Loading branch information
bahmutov authored Oct 22, 2019
1 parent dd70563 commit bd54e3d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cli/types/cypress-npm-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ declare module 'cypress' {

/**
* Results returned by the test run.
* @see https://on.cypress.io/module-api
*/
interface CypressRunResult {
startedTestsAt: dateTimeISO
Expand All @@ -465,6 +466,29 @@ declare module 'cypress' {
cypressVersion: string
// TODO add resolved object to the configuration
config: CypressConfiguration
/**
* If Cypress fails to run at all (for example, if there are no spec files to run),
* then it will set failures to 1 and will have actual error message in the
* property "message". Check this property before checking other properties.
*
* @type {number}
* @example
```
const result = await cypress.run()
if (result.failures) {
console.error(result.message)
process.exit(result.failures)
}
```
*/
failures?: number
/**
* If returned result has "failures" set, then this property gives
* the error message.
*
* @type {string}
*/
message?: string
}

/**
Expand Down
4 changes: 4 additions & 0 deletions cli/types/tests/cypress-npm-api-test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// type tests for Cypress NPM module
// https://on.cypress.io/module-api
import cypress from 'cypress'

cypress.run // $ExpectType (options?: Partial<CypressRunOptions> | undefined) => Promise<CypressRunResult>
Expand All @@ -7,6 +9,8 @@ cypress.run({}).then(results => {
})
cypress.run().then(results => {
results // $ExpectType CypressRunResult
results.failures // $ExpectType number | undefined
results.message // $ExpectType string | undefined
})
cypress.open() // $ExpectType Promise<void>
cypress.run() // $ExpectType Promise<CypressRunResult>
Expand Down

4 comments on commit bd54e3d

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on bd54e3d Oct 22, 2019

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/linux-x64/circle-develop-bd54e3dff79faa19303e41ec057e33b2afc3b4a1-170405/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-bd54e3dff79faa19303e41ec057e33b2afc3b4a1-170397/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on bd54e3d Oct 22, 2019

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-bd54e3dff79faa19303e41ec057e33b2afc3b4a1-28300449/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-bd54e3dff79faa19303e41ec057e33b2afc3b4a1-28300449/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on bd54e3d Oct 22, 2019

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-bd54e3dff79faa19303e41ec057e33b2afc3b4a1-28300449/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-bd54e3dff79faa19303e41ec057e33b2afc3b4a1-28300449/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on bd54e3d Oct 22, 2019

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/darwin-x64/circle-develop-bd54e3dff79faa19303e41ec057e33b2afc3b4a1-170414/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-bd54e3dff79faa19303e41ec057e33b2afc3b4a1-170413/cypress.tgz

Please sign in to comment.