Update a few missing TS types in CLI to get Kitchensink types check to pass (#7401)

This commit is contained in:
Gleb Bahmutov
2020-05-18 18:02:54 -04:00
committed by GitHub
parent a854089c77
commit 2e5bb50706
6 changed files with 602 additions and 360 deletions

View File

@@ -220,6 +220,11 @@ commands:
# force installing the freshly built binary
command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i ~/cypress/cypress.tgz
- run:
name: Types check 🧩 (maybe)
working_directory: /tmp/<<parameters.repo>>
command: npm run types --if-present
- run:
name: Build 🏗 (maybe)
working_directory: /tmp/<<parameters.repo>>
command: npm run build --if-present
- run:
@@ -367,7 +372,19 @@ jobs:
command: ls -la chai
working_directory: cli/types
- run:
command: yarn lerna exec --scope cypress "yarn dtslint"
name: "Lint types 🧹"
command: yarn lerna exec --scope cypress "yarn dtslint"
- run:
name: "TypeScript check 🧩"
command: echo Skipping for now
# TODO split cli/index.d.ts into separate TS files
# to be able to reference them from individual projects
# like this was doing it https://github.com/cypress-io/cypress/pull/7194/files
# packages/desktop-gui/index.d.ts
# packages/driver/index.d.ts
# packages/reporter/index.d.ts
# packages/runner/index.d.ts
# command: yarn type-check --ignore-progress
- store-npm-logs
build-system-unit-tests:
@@ -1400,6 +1417,10 @@ linux-workflow: &linux-workflow
requires:
- build-binary
- build-npm-package
- test-binary-against-kitchensink:
requires:
- build-binary
- build-npm-package
- post-pre-release-install-comment:
context: test-runner:commit-status-checks
filters:
@@ -1438,8 +1459,6 @@ linux-workflow: &linux-workflow
- test-binary-against-recipes-firefox:
<<: *testBinaryFirefox
- test-binary-against-kitchensink:
<<: *testBinaryFirefox
- test-binary-against-kitchensink-firefox:
<<: *testBinaryFirefox
- test-binary-against-kitchensink-chrome:

View File

@@ -1 +1,2 @@
save-exact=true
package-lock=false

View File

@@ -23,6 +23,7 @@
"@cypress/listr-verbose-renderer": "0.4.1",
"@cypress/request": "2.88.5",
"@cypress/xvfb": "1.2.4",
"@types/sinonjs__fake-timers": "6.0.1",
"@types/sizzle": "2.3.2",
"arch": "2.1.1",
"bluebird": "3.7.2",

11
cli/types/index.d.ts vendored
View File

@@ -29,7 +29,6 @@
// Cypress, cy, Log inherits EventEmitter.
type EventEmitter2 = import("eventemitter2").EventEmitter2
type Bluebird<R> = import("bluebird")<R>
// type helpers
type Nullable<T> = T | null
@@ -37,7 +36,7 @@ type Nullable<T> = T | null
interface EventEmitter extends EventEmitter2 {
proxyTo: (cy: Cypress.cy) => null
emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any>
emitThen: (eventName: string, args: any[]) => Bluebird<any>
emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic
}
// Cypress adds chai expect and assert to global
@@ -190,13 +189,13 @@ declare namespace Cypress {
* @example
* Cypress.Blob.method()
*/
Blob: typeof import('blob-util')
Blob: BlobUtil.BlobUtilStatic
/**
* Cypress automatically includes minimatch and exposes it as Cypress.minimatch.
*
* @see https://on.cypress.io/minimatch
*/
minimatch: typeof import('minimatch')
minimatch: typeof Minimatch.minimatch
/**
* Cypress automatically includes moment.js and exposes it as Cypress.moment.
*
@@ -205,7 +204,7 @@ declare namespace Cypress {
* @example
* const todaysDate = Cypress.moment().format("MMM DD, YYYY")
*/
moment: typeof import('moment')
moment: Moment.MomentStatic
/**
* Cypress automatically includes Bluebird and exposes it as Cypress.Promise.
*
@@ -214,7 +213,7 @@ declare namespace Cypress {
* @example
* new Cypress.Promise((resolve, reject) => { ... })
*/
Promise: typeof import('bluebird')
Promise: Bluebird.BluebirdStatic
/**
* Cypress includes Sinon.js library used in `cy.spy` and `cy.stub`.
*

View File

@@ -135,3 +135,10 @@ cy.clearLocalStorage()
cy.clearLocalStorage('todos')
cy.clearLocalStorage('todos', { log: false })
cy.clearLocalStorage({ log: false })
namespace BlobTests {
Cypress.Blob.imgSrcToDataURL('/some/path', undefined, 'anonymous')
.then((dateUrl) => {
dateUrl // $ExpectType string
})
}

917
yarn.lock

File diff suppressed because it is too large Load Diff