Skip to content

Commit

Permalink
fix: Introduce CypressCommandLine namespace to type NPM module api
Browse files Browse the repository at this point in the history
  • Loading branch information
sainthkh authored Jul 29, 2020
1 parent b5b92a4 commit 15c71c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cli/types/cypress-npm-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// in the future the NPM module itself will be in TypeScript
// but for now describe it as an ambient module

declare module 'cypress' {
declare namespace CypressCommandLine {
/**
* All options that one can pass to "cypress.run"
* @see https://on.cypress.io/module-api#cypress-run
Expand Down Expand Up @@ -324,7 +324,9 @@ declare module 'cypress' {
*/
parseRunArguments(args: string[]): Promise<Partial<CypressRunOptions>>
}
}

declare module 'cypress' {
/**
* Cypress NPM module interface.
* @see https://on.cypress.io/module-api
Expand All @@ -349,19 +351,19 @@ declare module 'cypress' {
})
```
*/
run(options?: Partial<CypressRunOptions>): Promise<CypressRunResult | CypressFailedRunResult>,
run(options?: Partial<CypressCommandLine.CypressRunOptions>): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult>,
/**
* Opens Cypress GUI. Resolves with void when the
* GUI is closed.
* @see https://on.cypress.io/module-api#cypress-open
*/
open(options?: Partial<CypressOpenOptions>): Promise<void>
open(options?: Partial<CypressCommandLine.CypressOpenOptions>): Promise<void>

/**
* Utility functions for parsing CLI arguments the same way
* Cypress does
*/
cli: CypressCliParser
cli: CypressCommandLine.CypressCliParser
}

// export Cypress NPM module interface
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
Expand Up @@ -38,3 +38,7 @@ const runConfig: Cypress.ConfigOptions = {
},
}
cypress.run({ config: runConfig })

cypress.run({}).then((results) => {
results as CypressCommandLine.CypressRunResult // $ExpectType CypressRunResult
})

4 comments on commit 15c71c5

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 15c71c5 Jul 29, 2020

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/5.0.0/linux-x64/circle-develop-15c71c5bd765159362f02b26431b75ece74d52df-409706/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/circle-develop-15c71c5bd765159362f02b26431b75ece74d52df-409684/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 15c71c5 Jul 29, 2020

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.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 15c71c5 Jul 29, 2020

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.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-15c71c5bd765159362f02b26431b75ece74d52df-34372511/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 15c71c5 Jul 29, 2020

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/5.0.0/darwin-x64/circle-develop-15c71c5bd765159362f02b26431b75ece74d52df-409713/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/circle-develop-15c71c5bd765159362f02b26431b75ece74d52df-409711/cypress.tgz

Please sign in to comment.