mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-22 15:11:00 -06:00
fix: revive type checker (#18172)
Co-authored-by: Zach Bloomquist <github@chary.us>
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
"@types/jquery": "3.3.31",
|
||||
"@types/lodash": "4.14.168",
|
||||
"@types/minimatch": "3.0.3",
|
||||
"@types/mocha": "5.2.7",
|
||||
"@types/mocha": "8.0.3",
|
||||
"@types/sinon": "7.5.1",
|
||||
"@types/sinon-chai": "3.2.5",
|
||||
"chai": "3.5.0",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
const { includeTypes } = require('./utils')
|
||||
const shell = require('shelljs')
|
||||
const fs = require('fs')
|
||||
const { join } = require('path')
|
||||
const resolvePkg = require('resolve-pkg')
|
||||
|
||||
@@ -72,3 +73,23 @@ shell.sed('-i', 'from \'sinon\';', 'from \'../sinon\';', sinonChaiFilename)
|
||||
// copy experimental network stubbing type definitions
|
||||
// so users can import: `import 'cypress/types/net-stubbing'`
|
||||
shell.cp(resolvePkg('@packages/net-stubbing/lib/external-types.ts'), 'types/net-stubbing.ts')
|
||||
|
||||
// https://github.com/cypress-io/cypress/issues/18069
|
||||
// To avoid type clashes, some files should be commented out entirely by patch-package
|
||||
// and uncommented here.
|
||||
|
||||
const filesToUncomment = [
|
||||
'mocha/index.d.ts',
|
||||
'jquery/JQuery.d.ts',
|
||||
'jquery/legacy.d.ts',
|
||||
'jquery/misc.d.ts',
|
||||
]
|
||||
|
||||
filesToUncomment.forEach((file) => {
|
||||
const filePath = join(__dirname, '../types', file)
|
||||
const str = fs.readFileSync(filePath).toString()
|
||||
|
||||
const result = str.split('\n').map((line) => line.substring(3)).join('\n')
|
||||
|
||||
fs.writeFileSync(filePath, result)
|
||||
})
|
||||
|
||||
5
cli/types/cy-bluebird.d.ts
vendored
5
cli/types/cy-bluebird.d.ts
vendored
@@ -1,11 +1,12 @@
|
||||
// Shim definition to export a namespace. Cypress is actually a global module
|
||||
// so import/export isn't allowed there. We import here and define a global module
|
||||
// so that Cypress can get and use the Blob type
|
||||
import BluebirdStatic = require('./bluebird')
|
||||
import ImportedBluebird = require('./bluebird')
|
||||
|
||||
export = Bluebird
|
||||
export as namespace Bluebird
|
||||
|
||||
declare namespace Bluebird {
|
||||
type BluebirdStatic = typeof BluebirdStatic
|
||||
type BluebirdStatic = typeof ImportedBluebird
|
||||
interface Promise<T> extends ImportedBluebird<T> {}
|
||||
}
|
||||
|
||||
9
cli/types/cypress.d.ts
vendored
9
cli/types/cypress.d.ts
vendored
@@ -170,6 +170,11 @@ declare namespace Cypress {
|
||||
*/
|
||||
interface ApplicationWindow { } // tslint:disable-line
|
||||
|
||||
/**
|
||||
* The configuration for Cypress.
|
||||
*/
|
||||
type Config = ResolvedConfigOptions & RuntimeConfigOptions
|
||||
|
||||
/**
|
||||
* Several libraries are bundled with Cypress by default.
|
||||
*
|
||||
@@ -297,7 +302,7 @@ declare namespace Cypress {
|
||||
/**
|
||||
* Fire automation:request event for internal use.
|
||||
*/
|
||||
automation(eventName: string, ...args: any[]): Promise<any>
|
||||
automation(eventName: string, ...args: any[]): Bluebird.Promise<any>
|
||||
|
||||
/**
|
||||
* Promise wrapper for certain internal tasks.
|
||||
@@ -313,7 +318,7 @@ declare namespace Cypress {
|
||||
// {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ...}
|
||||
```
|
||||
*/
|
||||
config(): ResolvedConfigOptions & RuntimeConfigOptions
|
||||
config(): Config
|
||||
/**
|
||||
* Returns one configuration value.
|
||||
* @see https://on.cypress.io/config
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="../../../../../cli/types/mocha/index.d.ts" />
|
||||
|
||||
import * as babel from '@babel/core'
|
||||
import { expect } from 'chai'
|
||||
import { createTransformPluginsFileBabelPlugin } from './babelTransform'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="../../../../../cli/types/mocha/index.d.ts" />
|
||||
|
||||
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'
|
||||
import { join, resolve } from 'path'
|
||||
import { expect } from 'chai'
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
"@types/glob": "7.1.1",
|
||||
"@types/lodash": "4.14.168",
|
||||
"@types/markdown-it": "0.0.9",
|
||||
"@types/mini-css-extract-plugin": "1.4.2",
|
||||
"@types/mini-css-extract-plugin": "1.2.3",
|
||||
"@types/mocha": "8.0.3",
|
||||
"@types/node": "14.14.31",
|
||||
"@types/prismjs": "1.16.0",
|
||||
@@ -165,7 +165,7 @@
|
||||
"mock-fs": "4.9.0",
|
||||
"odiff-bin": "2.1.0",
|
||||
"parse-github-repo-url": "1.4.1",
|
||||
"patch-package": "6.2.2",
|
||||
"patch-package": "6.4.7",
|
||||
"plist": "3.0.1",
|
||||
"pluralize": "8.0.0",
|
||||
"postinstall-postinstall": "2.0.0",
|
||||
|
||||
7
packages/desktop-gui/src/main.scss.d.ts
vendored
Normal file
7
packages/desktop-gui/src/main.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
@@ -1,3 +1,4 @@
|
||||
// @ts-ignore
|
||||
const { $, dom } = Cypress
|
||||
|
||||
describe('src/cypress/dom/visibility', () => {
|
||||
|
||||
5
packages/driver/index.d.ts
vendored
5
packages/driver/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
/// <reference path="../../cli/types/index.d.ts" />
|
||||
/// <reference path="../ts/index.d.ts" />
|
||||
/// <reference path="../../cli/types/jquery/index.d.ts" />
|
||||
|
||||
export const $Cypress: Cypress.Cypress
|
||||
|
||||
export const $: typeof JQuery
|
||||
export const $: JQuery
|
||||
export default $Cypress
|
||||
@@ -1,3 +1,15 @@
|
||||
/// <reference path="../../cli/types/chai-jquery/index.d.ts" />
|
||||
/// <reference path="../../cli/types/sinon-chai/index.d.ts" />
|
||||
/// <reference path="../../cli/types/cypress-expect.d.ts" />
|
||||
|
||||
/// <reference path="../ts/index.d.ts" />
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Cypress: Cypress.Cypress
|
||||
}
|
||||
}
|
||||
|
||||
import $Cypress from './src/main'
|
||||
|
||||
export default $Cypress
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
"@sinonjs/fake-timers": "7.0.2",
|
||||
"@types/chalk": "^2.2.0",
|
||||
"@types/common-tags": "^1.8.0",
|
||||
"@types/jquery.scrollto": "1.4.29",
|
||||
"@types/lodash": "^4.14.168",
|
||||
"@types/mocha": "^8.0.3",
|
||||
"@types/underscore.string": "0.0.38",
|
||||
"angular": "1.8.0",
|
||||
"basic-auth": "2.0.1",
|
||||
"blob-util": "2.0.2",
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* @version 2.1.3
|
||||
*/
|
||||
|
||||
/// <reference types="jquery.scrollto" />
|
||||
|
||||
/** eslint-disable */
|
||||
import $ from 'jquery'
|
||||
|
||||
@@ -109,7 +111,7 @@ export function scrollTo (target, duration, settings) {
|
||||
let max = $scrollTo.max(elem, axis)
|
||||
|
||||
if (toff) { // jQuery / DOMElement
|
||||
attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos])
|
||||
attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()![pos])
|
||||
|
||||
// If it's a dom element, reduce the margin
|
||||
if (settings.margin) {
|
||||
@@ -192,18 +194,25 @@ function both (val) {
|
||||
return isFunction(val) || $.isPlainObject(val) ? val : { top: val, left: val }
|
||||
}
|
||||
|
||||
// TODO: find the type of _last in the JQuery code.
|
||||
interface Tween extends JQuery.Tween<JQuery.Node> {
|
||||
_last: any
|
||||
}
|
||||
|
||||
// Add special hooks so that window scroll properties can be animated
|
||||
$.Tween.propHooks.scrollLeft =
|
||||
$.Tween.propHooks.scrollTop = {
|
||||
get (t) {
|
||||
return $(t.elem)[t.prop]()
|
||||
},
|
||||
set (t) {
|
||||
set (t: Tween) {
|
||||
let curr = this.get(t)
|
||||
|
||||
// If interrupt is true and user scrolled, stop animating
|
||||
if (t.options.interrupt && t._last && t._last !== curr) {
|
||||
return $(t.elem).stop()
|
||||
$(t.elem).stop()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
let next = Math.round(t.now)
|
||||
|
||||
@@ -10,3 +10,12 @@ _.mixin({
|
||||
})
|
||||
|
||||
export default _
|
||||
|
||||
declare module 'lodash' {
|
||||
interface LoDashStatic {
|
||||
clean: typeof clean
|
||||
count: typeof count
|
||||
isBlank: typeof isBlank
|
||||
toBoolean: typeof toBoolean
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,21 @@ const formatMouseEvents = (events) => {
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: remove any, Function, Record
|
||||
type MouseActionOptions = {
|
||||
subject: any
|
||||
positionOrX: string | number
|
||||
y: number
|
||||
userOptions: Record<string, any>
|
||||
onReady: Function
|
||||
onTable: Function
|
||||
defaultOptions?: Record<string, any>
|
||||
}
|
||||
|
||||
export default (Commands, Cypress, cy, state, config) => {
|
||||
const { mouse, keyboard } = cy.devices
|
||||
|
||||
const mouseAction = (eventName, { subject, positionOrX, y, userOptions, onReady, onTable, defaultOptions }) => {
|
||||
const mouseAction = (eventName, { subject, positionOrX, y, userOptions, onReady, onTable, defaultOptions }: MouseActionOptions) => {
|
||||
let position
|
||||
let x
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ import $elements from '../../../dom/elements'
|
||||
|
||||
export default (Commands, Cypress, cy) => {
|
||||
return Commands.addAll({ prevSubject: ['element', 'window'] }, {
|
||||
focus (subject, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
|
||||
focus (subject, options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
// we should throw errors by default!
|
||||
@@ -84,7 +85,8 @@ export default (Commands, Cypress, cy) => {
|
||||
return verifyAssertions()
|
||||
},
|
||||
|
||||
blur (subject, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.BlurOptions>
|
||||
blur (subject, options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
// we should throw errors by default!
|
||||
|
||||
@@ -30,7 +30,8 @@ const isNaNOrInfinity = (item) => {
|
||||
|
||||
export default (Commands, Cypress, cy, state) => {
|
||||
Commands.addAll({ prevSubject: 'element' }, {
|
||||
scrollIntoView (subject, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.ScrollToOptions>
|
||||
scrollIntoView (subject, options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
if (!_.isObject(userOptions)) {
|
||||
@@ -114,6 +115,9 @@ export default (Commands, Cypress, cy, state) => {
|
||||
const scrollIntoView = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// scroll our axes
|
||||
// TODO: done() came from jQuery animate(), specifically, EffectsOptions at misc.d.ts
|
||||
// The type definition should be fixed at @types/jquery.scrollto.
|
||||
// @ts-ignore
|
||||
return $(options.$parent).scrollTo(options.$el, {
|
||||
axis: options.axis,
|
||||
easing: options.easing,
|
||||
@@ -132,7 +136,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
},
|
||||
always () {
|
||||
if (parentIsWin) {
|
||||
return delete options.$parent.contentWindow
|
||||
delete options.$parent.contentWindow
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -153,7 +157,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
})
|
||||
|
||||
Commands.addAll({ prevSubject: ['optional', 'element', 'window'] }, {
|
||||
scrollTo (subject, xOrPosition, yOrOptions, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.ScrollToOptions>
|
||||
scrollTo (subject, xOrPosition, yOrOptions, options: any = {}) {
|
||||
let x; let y
|
||||
let userOptions = options
|
||||
|
||||
@@ -168,7 +173,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
y = yOrOptions
|
||||
}
|
||||
|
||||
let position = null
|
||||
let position: string | null = null
|
||||
|
||||
// we may be '50%' or 'bottomCenter'
|
||||
if (_.isString(xOrPosition)) {
|
||||
@@ -293,7 +298,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
$utils.filterOutOptions(options, { duration: 0, easing: 'swing' }),
|
||||
)
|
||||
|
||||
const messageArgs = []
|
||||
const messageArgs: string[] = []
|
||||
|
||||
if (position) {
|
||||
messageArgs.push(position)
|
||||
@@ -306,12 +311,12 @@ export default (Commands, Cypress, cy, state) => {
|
||||
messageArgs.push(deltaOptions)
|
||||
}
|
||||
|
||||
const log = {
|
||||
const log: Record<string, any> = {
|
||||
message: messageArgs.join(', '),
|
||||
timeout: options.timeout,
|
||||
consoleProps () {
|
||||
// merge into consoleProps without mutating it
|
||||
const obj = {}
|
||||
const obj: Record<string, any> = {}
|
||||
|
||||
if (position) {
|
||||
obj.Position = position
|
||||
@@ -357,10 +362,16 @@ export default (Commands, Cypress, cy, state) => {
|
||||
const scrollTo = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// scroll our axis'
|
||||
// TODO: done() came from jQuery animate(), specifically, EffectsOptions at misc.d.ts
|
||||
// The type definition should be fixed at @types/jquery.scrollto.
|
||||
// @ts-ignore
|
||||
$(options.$el).scrollTo({ left: x, top: y }, {
|
||||
axis: options.axis,
|
||||
easing: options.easing,
|
||||
duration: options.duration,
|
||||
// TODO: ensureScrollable option does not exist on jQuery or config/jquery.scrollto.ts.
|
||||
// It can be removed.
|
||||
// @ts-ignore
|
||||
ensureScrollable: options.ensureScrollable,
|
||||
done () {
|
||||
return resolve(options.$el)
|
||||
@@ -376,7 +387,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
})
|
||||
|
||||
if (isWin) {
|
||||
return delete options.$el.contentWindow
|
||||
delete options.$el.contentWindow
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ const newLineRe = /\n/g
|
||||
|
||||
export default (Commands, Cypress, cy) => {
|
||||
Commands.addAll({ prevSubject: 'element' }, {
|
||||
select (subject, valueOrTextOrIndex, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.SelectOptions>
|
||||
select (subject, valueOrTextOrIndex, options: any = {}) {
|
||||
if (
|
||||
!_.isNumber(valueOrTextOrIndex)
|
||||
&& !_.isString(valueOrTextOrIndex)
|
||||
@@ -35,7 +36,7 @@ export default (Commands, Cypress, cy) => {
|
||||
force: false,
|
||||
})
|
||||
|
||||
const consoleProps = {}
|
||||
const consoleProps: Record<string, any> = {}
|
||||
|
||||
if (options.log) {
|
||||
// figure out the options which actually change the behavior of clicks
|
||||
@@ -80,7 +81,7 @@ export default (Commands, Cypress, cy) => {
|
||||
}
|
||||
|
||||
// normalize valueOrTextOrIndex if its not an array
|
||||
valueOrTextOrIndex = [].concat(valueOrTextOrIndex).map((v) => {
|
||||
valueOrTextOrIndex = [].concat(valueOrTextOrIndex).map((v: any) => {
|
||||
if (_.isNumber(v) && (!_.isInteger(v) || v < 0)) {
|
||||
$errUtils.throwErrByPath('select.invalid_number', { args: { index: v } })
|
||||
}
|
||||
@@ -108,8 +109,8 @@ export default (Commands, Cypress, cy) => {
|
||||
$errUtils.throwErrByPath('select.disabled', { args: { node } })
|
||||
}
|
||||
|
||||
const values = []
|
||||
const optionEls = []
|
||||
const values: string[] = []
|
||||
const optionEls: JQuery<any>[] = []
|
||||
const optionsObjects = options.$el.find('option').map((index, el) => {
|
||||
// push the value in values array if its
|
||||
// found within the valueOrText
|
||||
@@ -266,7 +267,7 @@ export default (Commands, Cypress, cy) => {
|
||||
let selectedIndex = 0
|
||||
|
||||
_.each(optionEls, ($el) => {
|
||||
const index = _.findIndex(optionsObjects, (optionObject) => {
|
||||
const index = _.findIndex(optionsObjects, (optionObject: any) => {
|
||||
return $el.text() === optionObject.originalText
|
||||
})
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import $actionability from '../../actionability'
|
||||
|
||||
export default (Commands, Cypress, cy) => {
|
||||
Commands.addAll({ prevSubject: 'element' }, {
|
||||
submit (subject, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
|
||||
submit (subject, options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
options = _.defaults({}, userOptions, {
|
||||
|
||||
@@ -33,7 +33,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
})
|
||||
|
||||
Commands.addAll({
|
||||
clearLocalStorage (keys, options = {}) {
|
||||
clearLocalStorage (keys, options: Partial<Cypress.Loggable> = {}) {
|
||||
if (_.isPlainObject(keys)) {
|
||||
options = keys
|
||||
keys = null
|
||||
|
||||
@@ -10,7 +10,8 @@ import { getAliasedRequests, isDynamicAliasingPossible } from '../net-stubbing/a
|
||||
|
||||
export default (Commands, Cypress, cy, state) => {
|
||||
Commands.addAll({
|
||||
focused (options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
|
||||
focused (options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
options = _.defaults({}, userOptions, {
|
||||
@@ -71,7 +72,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
return resolveFocused()
|
||||
},
|
||||
|
||||
get (selector, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable & Cypress.Withinable & Cypress.Shadow>
|
||||
get (selector, options: any = {}) {
|
||||
const userOptions = options
|
||||
const ctx = this
|
||||
|
||||
@@ -92,7 +94,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
options.includeShadowDom = resolveShadowDomInclusion(Cypress, userOptions.includeShadowDom)
|
||||
|
||||
let aliasObj
|
||||
const consoleProps = {}
|
||||
const consoleProps: Record<string, any> = {}
|
||||
const start = (aliasType) => {
|
||||
if (options.log === false) {
|
||||
return
|
||||
@@ -120,7 +122,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
start(aliasType)
|
||||
}
|
||||
|
||||
const obj = {}
|
||||
const obj: any = {}
|
||||
|
||||
if (aliasType === 'dom') {
|
||||
_.extend(obj, {
|
||||
@@ -226,7 +228,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
// within our subject then filter out
|
||||
// anything not currently in the DOM
|
||||
if ($dom.isDetached(subject)) {
|
||||
subject = subject.filter((index, el) => $dom.isAttached(el))
|
||||
subject = (subject as any).filter((index, el) => $dom.isAttached(el))
|
||||
|
||||
// if we have nothing left
|
||||
// just go replay the commands
|
||||
@@ -246,6 +248,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
if ((err.type === 'length') && (err.actual < err.expected)) {
|
||||
return replayFrom = true
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
onRetry () {
|
||||
if (replayFrom) {
|
||||
@@ -347,7 +351,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
if ($el.selector == null) {
|
||||
$el.selector = selector
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// this is usually a sizzle error (invalid selector)
|
||||
err.onFail = () => {
|
||||
if (options.log === false) {
|
||||
@@ -407,7 +411,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
return resolveElements()
|
||||
},
|
||||
|
||||
root (options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
|
||||
root (options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
options = _.defaults({}, userOptions, { log: true })
|
||||
@@ -438,7 +443,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
})
|
||||
|
||||
Commands.addAll({ prevSubject: ['optional', 'window', 'document', 'element'] }, {
|
||||
contains (subject, filter, text, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable & Cypress.CaseMatchable & Cypress.Shadow>
|
||||
contains (subject, filter, text, options: any = {}) {
|
||||
let userOptions = options
|
||||
|
||||
// nuke our subject if its present but not an element.
|
||||
@@ -516,6 +522,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
|
||||
return `Expected to find content: '${text}' ${getPhrase()}but never did.`
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
let consoleProps
|
||||
@@ -583,6 +591,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
return null
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -697,7 +707,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
|
||||
options = _.defaults({}, userOptions, { log: true })
|
||||
|
||||
const consoleProps = {
|
||||
const consoleProps: Record<string, any> = {
|
||||
'Applied To': $dom.getElements(subject),
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ const whichAreOptional = (val, key) => {
|
||||
return (val === null) && OPTIONAL_OPTS.includes(key)
|
||||
}
|
||||
|
||||
const needsFormSpecified = (options = {}) => {
|
||||
const needsFormSpecified = (options: any = {}) => {
|
||||
const { body, json, headers } = options
|
||||
|
||||
// json isn't true, and we have an object body and the user
|
||||
@@ -58,13 +58,19 @@ const needsFormSpecified = (options = {}) => {
|
||||
return (json !== true) && _.isObject(body) && hasFormUrlEncodedContentTypeHeader(headers)
|
||||
}
|
||||
|
||||
interface BackendError {
|
||||
backend: boolean
|
||||
message?: string
|
||||
stack?: any
|
||||
}
|
||||
|
||||
export default (Commands, Cypress, cy, state, config) => {
|
||||
Commands.addAll({
|
||||
// allow our signature to be similar to cy.route
|
||||
// METHOD / URL / BODY
|
||||
// or object literal with all expanded options
|
||||
request (...args) {
|
||||
const o = {}
|
||||
const o: any = {}
|
||||
const userOptions = o
|
||||
|
||||
if (_.isObject(args[0])) {
|
||||
@@ -297,7 +303,11 @@ export default (Commands, Cypress, cy, state, config) => {
|
||||
|
||||
// reset content-type
|
||||
if (requestOpts.headers) {
|
||||
delete requestOpts.headers[Object.keys(requestOpts).find((key) => key.toLowerCase() === 'content-type')]
|
||||
const contentTypeKey = Object.keys(requestOpts).find((key) => key.toLowerCase() === 'content-type')
|
||||
|
||||
if (contentTypeKey) {
|
||||
delete requestOpts.headers[contentTypeKey]
|
||||
}
|
||||
} else {
|
||||
requestOpts.headers = {}
|
||||
}
|
||||
@@ -308,7 +318,7 @@ export default (Commands, Cypress, cy, state, config) => {
|
||||
|
||||
// socket.io ignores FormData.
|
||||
// So, we need to encode the data into base64 string format.
|
||||
const formBody = []
|
||||
const formBody: string[] = []
|
||||
|
||||
requestOpts.body.forEach((value, key) => {
|
||||
// HTTP line break style is \r\n.
|
||||
@@ -373,7 +383,7 @@ export default (Commands, Cypress, cy, state, config) => {
|
||||
timeout: options.timeout,
|
||||
},
|
||||
})
|
||||
}).catch({ backend: true }, (err) => {
|
||||
}).catch<void, BackendError>({ backend: true }, (err: BackendError) => {
|
||||
$errUtils.throwErrByPath('request.loading_failed', {
|
||||
onFail: options._log,
|
||||
args: {
|
||||
|
||||
@@ -18,10 +18,10 @@ const getViewportWidth = (state) => {
|
||||
return Math.min(state('viewportWidth'), window.innerWidth)
|
||||
}
|
||||
|
||||
const automateScreenshot = (state, options = {}) => {
|
||||
const automateScreenshot = (state, options: TakeScreenshotOptions = {}) => {
|
||||
const { runnable, timeout } = options
|
||||
|
||||
const titles = []
|
||||
const titles: string[] = []
|
||||
|
||||
// if this a hook then push both the current test title
|
||||
// and our own hook title
|
||||
@@ -150,7 +150,7 @@ const takeFullPageScreenshot = (state, automationOptions) => {
|
||||
|
||||
const resetScrollOverrides = scrollOverrides(win, doc)
|
||||
|
||||
const docHeight = $(doc).height()
|
||||
const docHeight = $(doc).height() as number
|
||||
const viewportHeight = getViewportHeight(state)
|
||||
const numScreenshots = Math.ceil(docHeight / viewportHeight)
|
||||
|
||||
@@ -279,7 +279,18 @@ const getBlackout = ({ capture, blackout }) => {
|
||||
return isAppOnly({ capture }) ? blackout : []
|
||||
}
|
||||
|
||||
const takeScreenshot = (Cypress, state, screenshotConfig, options = {}) => {
|
||||
// TODO: anys should be removed.
|
||||
type TakeScreenshotOptions = {
|
||||
name?: string
|
||||
subject?: any
|
||||
simple?: boolean
|
||||
testFailure?: boolean
|
||||
runnable?: any
|
||||
log?: any
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
const takeScreenshot = (Cypress, state, screenshotConfig, options: TakeScreenshotOptions = {}) => {
|
||||
const {
|
||||
capture,
|
||||
padding,
|
||||
@@ -294,7 +305,8 @@ const takeScreenshot = (Cypress, state, screenshotConfig, options = {}) => {
|
||||
|
||||
const startTime = new Date()
|
||||
|
||||
const send = (event, props, resolve) => {
|
||||
// TODO: is this ok to make `resolve` undefined?
|
||||
const send = (event, props, resolve?) => {
|
||||
Cypress.action(`cy:${event}`, props, resolve)
|
||||
}
|
||||
|
||||
@@ -323,6 +335,8 @@ const takeScreenshot = (Cypress, state, screenshotConfig, options = {}) => {
|
||||
if (disableTimersAndAnimations) {
|
||||
return cy.pauseTimers(true)
|
||||
}
|
||||
|
||||
return null
|
||||
})
|
||||
.then(() => {
|
||||
return sendAsync('before:screenshot', getOptions(true))
|
||||
@@ -336,6 +350,8 @@ const takeScreenshot = (Cypress, state, screenshotConfig, options = {}) => {
|
||||
if (disableTimersAndAnimations) {
|
||||
return cy.pauseTimers(false)
|
||||
}
|
||||
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
||||
@@ -424,7 +440,8 @@ export default function (Commands, Cypress, cy, state, config) {
|
||||
})
|
||||
|
||||
Commands.addAll({ prevSubject: ['optional', 'element', 'window', 'document'] }, {
|
||||
screenshot (subject, name, options = {}) {
|
||||
// TODO: any -> Partial<Loggable & Timeoutable & ScreenshotOptions>
|
||||
screenshot (subject, name, options: any = {}) {
|
||||
let userOptions = options
|
||||
|
||||
if (_.isObject(name)) {
|
||||
@@ -453,7 +470,7 @@ export default function (Commands, Cypress, cy, state, config) {
|
||||
|
||||
const isWin = $dom.isWindow(subject)
|
||||
|
||||
let screenshotConfig = _.pick(options, 'capture', 'scale', 'disableTimersAndAnimations', 'overwrite', 'blackout', 'waitForCommandSynchronization', 'padding', 'clip', 'onBeforeScreenshot', 'onAfterScreenshot')
|
||||
let screenshotConfig: any = _.pick(options, 'capture', 'scale', 'disableTimersAndAnimations', 'overwrite', 'blackout', 'waitForCommandSynchronization', 'padding', 'clip', 'onBeforeScreenshot', 'onAfterScreenshot')
|
||||
|
||||
screenshotConfig = $Screenshot.validate(screenshotConfig, 'screenshot', options._log)
|
||||
screenshotConfig = _.extend($Screenshot.getConfig(), screenshotConfig)
|
||||
|
||||
@@ -7,7 +7,8 @@ import $stackUtils from '../../cypress/stack_utils'
|
||||
|
||||
export default (Commands, Cypress, cy) => {
|
||||
Commands.addAll({
|
||||
task (task, arg, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
|
||||
task (task, arg, options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
options = _.defaults({}, userOptions, {
|
||||
|
||||
@@ -87,6 +87,13 @@ const autoShadowTraversals = {
|
||||
},
|
||||
}
|
||||
|
||||
type EachConsoleProps = {
|
||||
Selector: string
|
||||
'Applied To': any
|
||||
Yielded?: any
|
||||
Elements?: number | undefined
|
||||
}
|
||||
|
||||
export default (Commands, Cypress, cy) => {
|
||||
_.each(traversals, (traversal) => {
|
||||
Commands.add(traversal, { prevSubject: ['element', 'document'] }, (subject, arg1, arg2, options) => {
|
||||
@@ -110,7 +117,7 @@ export default (Commands, Cypress, cy) => {
|
||||
return args.join(', ')
|
||||
}
|
||||
|
||||
const consoleProps = {
|
||||
const consoleProps: EachConsoleProps = {
|
||||
Selector: getSelector(),
|
||||
'Applied To': $dom.getElements(subject),
|
||||
}
|
||||
@@ -166,7 +173,7 @@ export default (Commands, Cypress, cy) => {
|
||||
// normalize the selector since jQuery won't have it
|
||||
// or completely borks it
|
||||
$el.selector = getSelector()
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
e.onFail = () => {
|
||||
return options._log.error(e)
|
||||
}
|
||||
|
||||
@@ -24,6 +24,12 @@ const throwErr = (arg) => {
|
||||
$errUtils.throwErrByPath('wait.invalid_1st_arg', { args: { arg } })
|
||||
}
|
||||
|
||||
type Alias = {
|
||||
name: string
|
||||
cardinal: number
|
||||
ordinal: number
|
||||
}
|
||||
|
||||
export default (Commands, Cypress, cy, state) => {
|
||||
const waitNumber = (subject, ms, options) => {
|
||||
// increase the timeout by the delta
|
||||
@@ -83,7 +89,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
return xhr
|
||||
}
|
||||
|
||||
const args = [alias, type, index, num, options]
|
||||
const args: [any, any, any, any, any] = [alias, type, index, num, options]
|
||||
|
||||
return cy.retry(() => {
|
||||
return checkForXhr.apply(window, args)
|
||||
@@ -147,7 +153,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
// because wait can reference an array of aliases
|
||||
if (log) {
|
||||
const referencesAlias = log.get('referencesAlias') || []
|
||||
const aliases = [].concat(referencesAlias)
|
||||
const aliases: Array<Alias> = [].concat(referencesAlias)
|
||||
|
||||
if (str) {
|
||||
aliases.push({
|
||||
@@ -279,7 +285,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
}
|
||||
|
||||
options = _.defaults({}, options, { log: true })
|
||||
const args = [subject, msOrAlias, options]
|
||||
const args: any = [subject, msOrAlias, options]
|
||||
|
||||
try {
|
||||
if (_.isFinite(msOrAlias)) {
|
||||
@@ -316,7 +322,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
}
|
||||
|
||||
return throwErr(arg)
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (err.name === 'CypressError') {
|
||||
throw err
|
||||
} else {
|
||||
|
||||
@@ -26,15 +26,17 @@ const viewports = {
|
||||
|
||||
const validOrientations = ['landscape', 'portrait']
|
||||
|
||||
type CurrentViewport = Pick<Cypress.Config, 'viewportWidth' | 'viewportHeight'>
|
||||
|
||||
// NOTE: this is outside the function because its 'global' state to the
|
||||
// cypress application and not local to the specific run. the last
|
||||
// viewport set is always the 'current' viewport as opposed to the
|
||||
// config. there was a bug where re-running tests without a hard
|
||||
// refresh would cause viewport to hang
|
||||
let currentViewport = null
|
||||
let currentViewport: CurrentViewport | null = null
|
||||
|
||||
export default (Commands, Cypress, cy, state) => {
|
||||
const defaultViewport = _.pick(Cypress.config(), 'viewportWidth', 'viewportHeight')
|
||||
const defaultViewport: CurrentViewport = _.pick(Cypress.config() as Cypress.Config, 'viewportWidth', 'viewportHeight')
|
||||
|
||||
// currentViewport could already be set due to previous runs
|
||||
currentViewport = currentViewport || defaultViewport
|
||||
@@ -57,7 +59,7 @@ export default (Commands, Cypress, cy, state) => {
|
||||
state(viewport)
|
||||
|
||||
return new Promise((resolve) => {
|
||||
if (currentViewport.viewportWidth === width && currentViewport.viewportHeight === height) {
|
||||
if (currentViewport!.viewportWidth === width && currentViewport!.viewportHeight === height) {
|
||||
// noop if viewport won't change
|
||||
return resolve(currentViewport)
|
||||
}
|
||||
@@ -76,7 +78,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
}
|
||||
|
||||
Commands.addAll({
|
||||
title (options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
|
||||
title (options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
options = _.defaults({}, userOptions, { log: true })
|
||||
@@ -98,7 +101,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
return resolveTitle()
|
||||
},
|
||||
|
||||
window (options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
|
||||
window (options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
options = _.defaults({}, userOptions, { log: true })
|
||||
@@ -140,7 +144,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
return verifyAssertions()
|
||||
},
|
||||
|
||||
document (options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
|
||||
document (options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
options = _.defaults({}, userOptions, { log: true })
|
||||
@@ -183,7 +188,8 @@ export default (Commands, Cypress, cy, state) => {
|
||||
return verifyAssertions()
|
||||
},
|
||||
|
||||
viewport (presetOrWidth, heightOrOrientation, options = {}) {
|
||||
// TODO: any -> Partial<Cypress.Loggable>
|
||||
viewport (presetOrWidth, heightOrOrientation, options: any = {}) {
|
||||
const userOptions = options
|
||||
|
||||
if (_.isObject(heightOrOrientation)) {
|
||||
@@ -202,9 +208,12 @@ export default (Commands, Cypress, cy, state) => {
|
||||
const isPreset = typeof presetOrWidth === 'string'
|
||||
|
||||
options._log = Cypress.log({
|
||||
// TODO: timeout below should be removed
|
||||
// because cy.viewport option doesn't support `timeout`
|
||||
// @see https://docs.cypress.io/api/commands/viewport#Arguments
|
||||
timeout: options.timeout,
|
||||
consoleProps () {
|
||||
const obj = {}
|
||||
const obj: Record<string, string | number> = {}
|
||||
|
||||
if (isPreset) {
|
||||
obj.Preset = presetOrWidth
|
||||
|
||||
@@ -5,10 +5,10 @@ import Promise from 'bluebird'
|
||||
import $utils from '../../cypress/utils'
|
||||
import $errUtils from '../../cypress/error_utils'
|
||||
import $stackUtils from '../../cypress/stack_utils'
|
||||
import $Server from '../../cypress/server'
|
||||
import $Server, { Server } from '../../cypress/server'
|
||||
import { $Location } from '../../cypress/location'
|
||||
|
||||
let server = null
|
||||
let server: Server | null = null
|
||||
|
||||
const tryDecodeUri = (uri) => {
|
||||
try {
|
||||
@@ -85,6 +85,21 @@ const setResponse = (state, xhr) => {
|
||||
return state('responses', responses)
|
||||
}
|
||||
|
||||
type XHRConsoleProps = {
|
||||
Alias: string
|
||||
Method: string
|
||||
URL: string
|
||||
'Matched URL': string
|
||||
Status: string
|
||||
Duration: number
|
||||
Stubbed: 'Yes' | 'No'
|
||||
Request: object
|
||||
Response: object
|
||||
XHR: object
|
||||
Note?: string
|
||||
groups?: () => Array<object>
|
||||
}
|
||||
|
||||
const startXhrServer = (cy, state, config) => {
|
||||
const logs = {}
|
||||
|
||||
@@ -119,7 +134,7 @@ const startXhrServer = (cy, state, config) => {
|
||||
event: true,
|
||||
timeout: 0,
|
||||
consoleProps: () => {
|
||||
const consoleObj = {
|
||||
const consoleObj: XHRConsoleProps = {
|
||||
Alias: alias,
|
||||
Method: xhr.method,
|
||||
URL: xhr.url,
|
||||
|
||||
@@ -6,7 +6,7 @@ import $errUtils from '../cypress/error_utils'
|
||||
import { USKeyboard } from '../cypress/UsKeyboardLayout'
|
||||
import $dom from '../dom'
|
||||
import $document from '../dom/document'
|
||||
import $elements from '../dom/elements'
|
||||
import $elements, { HTMLTextLikeInputElement } from '../dom/elements'
|
||||
// eslint-disable-next-line no-duplicate-imports
|
||||
import type { HTMLTextLikeElement } from '../dom/elements'
|
||||
import $selection from '../dom/selection'
|
||||
@@ -803,7 +803,7 @@ export class Keyboard {
|
||||
debug('setting element value', valToSet, activeEl)
|
||||
|
||||
return $elements.setNativeProp(
|
||||
activeEl as $elements.HTMLTextLikeInputElement,
|
||||
activeEl as HTMLTextLikeInputElement,
|
||||
'value',
|
||||
valToSet,
|
||||
)
|
||||
|
||||
@@ -87,7 +87,7 @@ export default {
|
||||
padding: '20px',
|
||||
width: dimensions('outerWidth'),
|
||||
height: dimensions('outerHeight'),
|
||||
})
|
||||
}) as JQuery<HTMLIFrameElement>
|
||||
|
||||
$iframes.eq(idx).replaceWith($placeholder)
|
||||
const contents = `\
|
||||
|
||||
@@ -78,7 +78,7 @@ const getRedirects = (obj, phrase, listIndentSize) => {
|
||||
const getHttpProps = (fields: { value: string, key: string }[] = []) => {
|
||||
return _
|
||||
.chain(fields)
|
||||
.reduce(formatProp, [])
|
||||
.reduce<string[]>(formatProp, [])
|
||||
.join('\n')
|
||||
.value()
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ const isSpecError = (spec, err) => {
|
||||
return _.includes(err.stack, spec.relative)
|
||||
}
|
||||
|
||||
const mergeErrProps = (origErr, ...newProps) => {
|
||||
const mergeErrProps = (origErr: Error, ...newProps) => {
|
||||
return _.extend(origErr, ...newProps)
|
||||
}
|
||||
|
||||
@@ -262,6 +262,8 @@ export class InternalCypressError extends Error {
|
||||
}
|
||||
|
||||
export class CypressError extends Error {
|
||||
docsUrl?: string
|
||||
|
||||
constructor (message) {
|
||||
super(message)
|
||||
|
||||
@@ -283,13 +285,13 @@ const getUserInvocationStackFromError = (err) => {
|
||||
return err.userInvocationStack
|
||||
}
|
||||
|
||||
const internalErr = (err) => {
|
||||
const internalErr = (err): InternalCypressError => {
|
||||
const newErr = new InternalCypressError(err.message)
|
||||
|
||||
return mergeErrProps(newErr, err)
|
||||
}
|
||||
|
||||
const cypressErr = (err) => {
|
||||
const cypressErr = (err): CypressError => {
|
||||
const newErr = new CypressError(err.message)
|
||||
|
||||
return mergeErrProps(newErr, err)
|
||||
@@ -339,7 +341,7 @@ const docsUrlByParents = (msgPath) => {
|
||||
return docsUrlByParents(msgPath)
|
||||
}
|
||||
|
||||
const errByPath = (msgPath, args) => {
|
||||
const errByPath = (msgPath, args?) => {
|
||||
let msgValue = _.get($errorMessages, msgPath)
|
||||
|
||||
if (!msgValue) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import _ from 'lodash'
|
||||
import type { Interception, Route } from '@packages/net-stubbing/lib/types'
|
||||
import type { BrowserPreRequest, BrowserResponseReceived, RequestError } from '@packages/proxy/lib/types'
|
||||
import $errUtils from './error_utils'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _ from 'lodash'
|
||||
import type $Cypress from '../..'
|
||||
|
||||
/**
|
||||
* Fix property reads and writes that could potentially help the AUT to break out of its iframe.
|
||||
@@ -9,7 +8,7 @@ import type $Cypress from '../..'
|
||||
* @param accessedProp the property name being accessed (Symbol/number properties are not intercepted)
|
||||
* @param value the right-hand side of an assignment operation (accessedObject.accessedProp = value)
|
||||
*/
|
||||
export function resolveWindowReference (this: typeof $Cypress, currentWindow: Window, accessedObject: Window | any, accessedProp: string, value?: any) {
|
||||
export function resolveWindowReference (this: Cypress.Cypress, currentWindow: Window, accessedObject: Window | any, accessedProp: string, value?: any) {
|
||||
const { dom, state } = this
|
||||
|
||||
const getTargetValue = () => {
|
||||
|
||||
@@ -6,7 +6,12 @@ import $errUtils from './error_utils'
|
||||
|
||||
const SELECTOR_PRIORITIES = 'data-cy data-test data-testid id class tag attributes nth-child'.split(' ')
|
||||
|
||||
const reset = () => {
|
||||
type Defaults = {
|
||||
onElement: Cypress.SelectorPlaygroundDefaultsOptions['onElement'] | null
|
||||
selectorPriority: Cypress.SelectorPlaygroundDefaultsOptions['selectorPriority']
|
||||
}
|
||||
|
||||
const reset = (): Defaults => {
|
||||
return {
|
||||
onElement: null,
|
||||
selectorPriority: SELECTOR_PRIORITIES,
|
||||
|
||||
@@ -166,7 +166,15 @@ const defaults = (obj = {}) => {
|
||||
return _.extend(serverDefaults, obj)
|
||||
}
|
||||
|
||||
const create = (options = {}) => {
|
||||
// TODO: Convert it to a class.
|
||||
// It's written in this way to bypass type failures.
|
||||
export type Server = {
|
||||
restore: () => void
|
||||
cancelPendingXhrs: () => any[]
|
||||
bindTo: (win: Window) => void
|
||||
}
|
||||
|
||||
const create = (options = {}): Server => {
|
||||
options = _.defaults(options, serverDefaults)
|
||||
|
||||
const xhrs = {}
|
||||
|
||||
@@ -22,13 +22,44 @@ const getFirstValidSizedRect = (el) => {
|
||||
}) || el.getBoundingClientRect() // otherwise fall back to the parent client rect
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {JQuery<HTMLElement> | HTMLElement} $el
|
||||
*/
|
||||
const getElementPositioning = ($el) => {
|
||||
type ElementPositioning = {
|
||||
scrollTop: number
|
||||
scrollLeft: number
|
||||
width: number
|
||||
height: number
|
||||
fromElViewport: {
|
||||
doc: Document
|
||||
x?: number
|
||||
y?: number
|
||||
top: number
|
||||
left: number
|
||||
right: number
|
||||
bottom: number
|
||||
topCenter: number
|
||||
leftCenter: number
|
||||
}
|
||||
fromElWindow: {
|
||||
x?: number
|
||||
y?: number
|
||||
top: number
|
||||
left: number
|
||||
topCenter: number
|
||||
leftCenter: number
|
||||
}
|
||||
fromAutWindow: {
|
||||
x?: number
|
||||
y?: number
|
||||
top: number
|
||||
left: number
|
||||
topCenter: number
|
||||
leftCenter: number
|
||||
}
|
||||
}
|
||||
|
||||
const getElementPositioning = ($el: JQuery<HTMLElement> | HTMLElement): ElementPositioning => {
|
||||
let autFrame
|
||||
|
||||
const el = $jquery.isJquery($el) ? $el[0] : $el
|
||||
const el: HTMLElement = $jquery.isJquery($el) ? $el[0] : $el
|
||||
|
||||
const win = $window.getWindowByElement(el)
|
||||
|
||||
@@ -128,7 +159,12 @@ const getElementPositioning = ($el) => {
|
||||
}
|
||||
}
|
||||
|
||||
const getCoordsByPosition = (left, top, xPosition = 'center', yPosition = 'center') => {
|
||||
const getCoordsByPosition = (
|
||||
left: number,
|
||||
top: number,
|
||||
xPosition: 'left' | 'center' | 'right' = 'center',
|
||||
yPosition: 'top' | 'center' | 'bottom' = 'center',
|
||||
) => {
|
||||
const getLeft = () => {
|
||||
/* eslint-disable default-case */
|
||||
switch (xPosition) {
|
||||
|
||||
@@ -18,7 +18,7 @@ const descriptor = <T extends keyof Window, K extends keyof Window[T]['prototype
|
||||
return desc
|
||||
}
|
||||
|
||||
const _getValue = function () {
|
||||
const _getValue = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return descriptor('HTMLInputElement', 'value').get
|
||||
}
|
||||
@@ -39,7 +39,7 @@ const _getValue = function () {
|
||||
return descriptor('HTMLOptionElement', 'value').get
|
||||
}
|
||||
|
||||
const _setValue = function () {
|
||||
const _setValue = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return descriptor('HTMLInputElement', 'value').set
|
||||
}
|
||||
@@ -60,7 +60,7 @@ const _setValue = function () {
|
||||
return descriptor('HTMLOptionElement', 'value').set
|
||||
}
|
||||
|
||||
const _getSelectionStart = function () {
|
||||
const _getSelectionStart = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return descriptor('HTMLInputElement', 'selectionStart').get
|
||||
}
|
||||
@@ -72,7 +72,7 @@ const _getSelectionStart = function () {
|
||||
throw new Error('this should never happen, cannot get selectionStart')
|
||||
}
|
||||
|
||||
const _getSelectionEnd = function () {
|
||||
const _getSelectionEnd = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return descriptor('HTMLInputElement', 'selectionEnd').get
|
||||
}
|
||||
@@ -84,7 +84,7 @@ const _getSelectionEnd = function () {
|
||||
throw new Error('this should never happen, cannot get selectionEnd')
|
||||
}
|
||||
|
||||
const _nativeFocus = function () {
|
||||
const _nativeFocus = function (this: any) {
|
||||
if ($window.isWindow(this)) {
|
||||
return window.focus
|
||||
}
|
||||
@@ -96,7 +96,7 @@ const _nativeFocus = function () {
|
||||
return window.HTMLElement.prototype.focus
|
||||
}
|
||||
|
||||
const _nativeBlur = function () {
|
||||
const _nativeBlur = function (this: any) {
|
||||
if ($window.isWindow(this)) {
|
||||
return window.blur
|
||||
}
|
||||
@@ -108,7 +108,7 @@ const _nativeBlur = function () {
|
||||
return window.HTMLElement.prototype.blur
|
||||
}
|
||||
|
||||
const _nativeSetSelectionRange = function () {
|
||||
const _nativeSetSelectionRange = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return window.HTMLInputElement.prototype.setSelectionRange
|
||||
}
|
||||
@@ -117,7 +117,7 @@ const _nativeSetSelectionRange = function () {
|
||||
return window.HTMLTextAreaElement.prototype.setSelectionRange
|
||||
}
|
||||
|
||||
const _nativeSelect = function () {
|
||||
const _nativeSelect = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return window.HTMLInputElement.prototype.select
|
||||
}
|
||||
@@ -126,7 +126,7 @@ const _nativeSelect = function () {
|
||||
return window.HTMLTextAreaElement.prototype.select
|
||||
}
|
||||
|
||||
const _isContentEditable = function () {
|
||||
const _isContentEditable = function (this: any) {
|
||||
if (isSvg(this)) {
|
||||
return false
|
||||
}
|
||||
@@ -134,7 +134,7 @@ const _isContentEditable = function () {
|
||||
return descriptor('HTMLElement', 'isContentEditable').get
|
||||
}
|
||||
|
||||
const _setType = function () {
|
||||
const _setType = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return descriptor('HTMLInputElement', 'type').set
|
||||
}
|
||||
@@ -146,7 +146,7 @@ const _setType = function () {
|
||||
throw new Error('this should never happen, cannot set type')
|
||||
}
|
||||
|
||||
const _getType = function () {
|
||||
const _getType = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return descriptor('HTMLInputElement', 'type').get
|
||||
}
|
||||
@@ -158,7 +158,7 @@ const _getType = function () {
|
||||
throw new Error('this should never happen, cannot get type')
|
||||
}
|
||||
|
||||
const _getMaxLength = function () {
|
||||
const _getMaxLength = function (this: any) {
|
||||
if (isInput(this)) {
|
||||
return descriptor('HTMLInputElement', 'maxLength').get
|
||||
}
|
||||
|
||||
@@ -645,7 +645,7 @@ const getCaretPosition = function (el) {
|
||||
return null
|
||||
}
|
||||
|
||||
const interceptSelect = function () {
|
||||
const interceptSelect = function (this: any) {
|
||||
if ($elements.isInput(this) && !$elements.canSetSelectionRangeElement(this)) {
|
||||
setSelectionRange(this, 0, $elements.getNativeProp(this, 'value').length)
|
||||
}
|
||||
|
||||
5
packages/driver/types/internal-types.d.ts
vendored
5
packages/driver/types/internal-types.d.ts
vendored
@@ -16,6 +16,11 @@ declare namespace Cypress {
|
||||
queue: any
|
||||
retry: (fn: () => any, opts: any) => any
|
||||
state: State
|
||||
pauseTimers: <T>(shouldPause: boolean) => Cypress.Chainable<T>
|
||||
// TODO: this function refers to clearTimeout at cy/timeouts.ts, which doesn't have any argument.
|
||||
// But in many cases like cy/commands/screenshot.ts, it's called with a timeout id string.
|
||||
// We should decide whether calling with id is correct or not.
|
||||
clearTimeout: <T>(timeoutId?: string) => Cypress.Chainable<T>
|
||||
}
|
||||
|
||||
interface Cypress {
|
||||
|
||||
5
packages/extension/index.d.ts
vendored
Normal file
5
packages/extension/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/// <reference path="../../cli/types/jquery/index.d.ts" />
|
||||
|
||||
declare const lib: typeof import('./lib/extension')
|
||||
|
||||
export default lib
|
||||
@@ -18,7 +18,6 @@
|
||||
"throttle": "^1.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "7.0.2",
|
||||
"bin-up": "1.2.0",
|
||||
"chai": "4.2.0",
|
||||
"mocha": "7.1.2"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ from 'lodash'
|
||||
import { action, computed, observable } from 'mobx'
|
||||
|
||||
import Err from '../errors/err-model'
|
||||
import Err, { ErrProps } from '../errors/err-model'
|
||||
import Instrument, { InstrumentProps } from '../instruments/instrument-model'
|
||||
import type { TimeoutID } from '../lib/types'
|
||||
|
||||
@@ -20,7 +20,7 @@ interface RenderProps {
|
||||
}
|
||||
|
||||
export interface CommandProps extends InstrumentProps {
|
||||
err?: Err
|
||||
err?: ErrProps
|
||||
event?: boolean
|
||||
number?: number
|
||||
numElements: number
|
||||
|
||||
7
packages/reporter/src/main-runner.scss.d.ts
vendored
Normal file
7
packages/reporter/src/main-runner.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
7
packages/reporter/src/main.scss.d.ts
vendored
Normal file
7
packages/reporter/src/main.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
@@ -3,7 +3,7 @@ import { action, computed, observable } from 'mobx'
|
||||
import { FileDetails } from '@packages/ui-components'
|
||||
|
||||
import Attempt from '../attempts/attempt-model'
|
||||
import Err from '../errors/err-model'
|
||||
import Err, { ErrProps } from '../errors/err-model'
|
||||
import { HookProps } from '../hooks/hook-model'
|
||||
import Runnable, { RunnableProps } from '../runnables/runnable-model'
|
||||
import { CommandProps } from '../commands/command-model'
|
||||
@@ -18,7 +18,7 @@ export type UpdateTestCallback = () => void
|
||||
|
||||
export interface TestProps extends RunnableProps {
|
||||
state: TestState | null
|
||||
err?: Err
|
||||
err?: ErrProps
|
||||
isOpen?: boolean
|
||||
agents?: Array<AgentProps>
|
||||
commands?: Array<CommandProps>
|
||||
|
||||
7
packages/runner-ct/src/app/KeyboardHelper.scss.d.ts
vendored
Normal file
7
packages/runner-ct/src/app/KeyboardHelper.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
7
packages/runner-ct/src/app/NoSpec.scss.d.ts
vendored
Normal file
7
packages/runner-ct/src/app/NoSpec.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
8
packages/runner-ct/src/app/ReporterHeader.module.scss.d.ts
vendored
Normal file
8
packages/runner-ct/src/app/ReporterHeader.module.scss.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
'ctReporterHeader': string;
|
||||
'display-none': string;
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
27
packages/runner-ct/src/app/RunnerCt.module.scss.d.ts
vendored
Normal file
27
packages/runner-ct/src/app/RunnerCt.module.scss.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
'app': string;
|
||||
'appWrapper': string;
|
||||
'appWrapperScreenshotting': string;
|
||||
'ctDevtoolsContainer': string;
|
||||
'ctPluginToggleButton': string;
|
||||
'ctPlugins': string;
|
||||
'ctPluginsHeader': string;
|
||||
'ctPluginsName': string;
|
||||
'ctTogglePluginsSectionButton': string;
|
||||
'ctTogglePluginsSectionButtonOpen': string;
|
||||
'display-none': string;
|
||||
'folder': string;
|
||||
'largerIcon': string;
|
||||
'leftNav': string;
|
||||
'noSpecAut': string;
|
||||
'noSpecsDescription': string;
|
||||
'reporter': string;
|
||||
'runner': string;
|
||||
'runnerCt': string;
|
||||
'screenshotting': string;
|
||||
'size-container': string;
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
7
packages/runner-ct/src/app/RunnerCt.scss.d.ts
vendored
Normal file
7
packages/runner-ct/src/app/RunnerCt.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
7
packages/runner-ct/src/iframe/iframes.scss.d.ts
vendored
Normal file
7
packages/runner-ct/src/iframe/iframes.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
7
packages/runner-ct/src/plugins/devtools-fallback.scss.d.ts
vendored
Normal file
7
packages/runner-ct/src/plugins/devtools-fallback.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
@@ -230,7 +230,7 @@ export class Header extends Component<HeaderProps> {
|
||||
}
|
||||
|
||||
this.props.state.updateWindowDimensions({
|
||||
headerHeight: $(this.headerRef.current).outerHeight(),
|
||||
headerHeight: $(this.headerRef.current).outerHeight() as number,
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
7
packages/runner-shared/src/message/message.scss.d.ts
vendored
Normal file
7
packages/runner-shared/src/message/message.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { observer } from 'mobx-react'
|
||||
import * as React from 'react'
|
||||
import type * as React from 'react'
|
||||
|
||||
/**
|
||||
* Wraps MobX `observer` to properly add a component `displayName` for debugging purposes
|
||||
|
||||
7
packages/runner-shared/src/selector-playground/selector-playground.scss.d.ts
vendored
Normal file
7
packages/runner-shared/src/selector-playground/selector-playground.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
7
packages/runner-shared/src/snapshot-controls/snapshot-controls.scss.d.ts
vendored
Normal file
7
packages/runner-shared/src/snapshot-controls/snapshot-controls.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
13
packages/runner-shared/src/spec-list/SpecList.module.scss.d.ts
vendored
Normal file
13
packages/runner-shared/src/spec-list/SpecList.module.scss.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
'a': string;
|
||||
'isClosed': string;
|
||||
'isSelected': string;
|
||||
'li': string;
|
||||
'nav': string;
|
||||
'searchInput': string;
|
||||
'ul': string;
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import React, { useCallback, useMemo, useRef } from 'react'
|
||||
import React, { MutableRefObject, useCallback, useMemo, useRef } from 'react'
|
||||
import cs from 'classnames'
|
||||
import { throttle } from 'lodash'
|
||||
import { SearchInput, FileTree, SpecificTreeNode, TreeFile, FileBase, TreeFolder, VirtualizedTreeRef } from '@cypress/design-system'
|
||||
@@ -47,7 +47,7 @@ export const SpecList: React.FC<SpecListProps> = ({ searchRef, className, specs,
|
||||
}
|
||||
}, [searchRef])
|
||||
|
||||
const onEnter = useCallback(() => fileTreeRef.current.focus(), [])
|
||||
const onEnter = useCallback(() => fileTreeRef.current!.focus(), [])
|
||||
|
||||
const onVerticalArrowKey = useCallback((arrow: 'up' | 'down') => {
|
||||
if (arrow === 'down') {
|
||||
@@ -74,7 +74,7 @@ export const SpecList: React.FC<SpecListProps> = ({ searchRef, className, specs,
|
||||
<div>
|
||||
{/* TODO: Do we need any other rootDirectories? */}
|
||||
<FileTree
|
||||
innerRef={fileTreeRef}
|
||||
innerRef={fileTreeRef as MutableRefObject<VirtualizedTreeRef>}
|
||||
files={matches}
|
||||
rootDirectory="/"
|
||||
emptyPlaceholder="No specs found"
|
||||
|
||||
7
packages/runner-shared/src/studio/assertions-menu.scss.d.ts
vendored
Normal file
7
packages/runner-shared/src/studio/assertions-menu.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
7
packages/runner-shared/src/studio/studio-modals.scss.d.ts
vendored
Normal file
7
packages/runner-shared/src/studio/studio-modals.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
7
packages/runner-shared/src/styles.module.scss.d.ts
vendored
Normal file
7
packages/runner-shared/src/styles.module.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
'specsList': string;
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
3
packages/runner/index.d.ts
vendored
3
packages/runner/index.d.ts
vendored
@@ -5,3 +5,6 @@
|
||||
/// <reference path="../../cli/types/cypress.d.ts" />
|
||||
/// <reference path="../../cli/types/cypress-global-vars.d.ts" />
|
||||
/// <reference path="../../cli/types/cypress-type-helpers.d.ts" />
|
||||
|
||||
/// <reference path="../ts/index.d.ts" />
|
||||
/// <reference path="../driver/types/internal-types.d.ts" />
|
||||
|
||||
7
packages/runner/src/main.scss.d.ts
vendored
Normal file
7
packages/runner/src/main.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
1
packages/server/index.d.ts
vendored
1
packages/server/index.d.ts
vendored
@@ -4,6 +4,7 @@
|
||||
/// <reference path="../../cli/types/lodash/index.d.ts" />
|
||||
/// <reference path="../../cli/types/sinon/index.d.ts" />
|
||||
/// <reference path="../../cli/types/jquery/index.d.ts" />
|
||||
/// <reference path="../../cli/types/mocha/index.d.ts" />
|
||||
|
||||
/// <reference path="../../cli/types/cypress-npm-api.d.ts" />
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ const _normalizeArgExtensions = function (extPath, args, pluginExtensions, brows
|
||||
userExtensions = userExtensions.concat(pluginExtensions)
|
||||
}
|
||||
|
||||
const extensions = [].concat(userExtensions, extPath, pathToTheme)
|
||||
const extensions = ([] as any).concat(userExtensions, extPath, pathToTheme)
|
||||
|
||||
args.push(LOAD_EXTENSION + _.compact(extensions).join(','))
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
// https://github.com/cypress-io/cypress/issues/18069
|
||||
// This fixture project is copied to packages/server/.project and executed there.
|
||||
// Because of that, the reference path is wrong here.
|
||||
/// <reference path="../../../../../../cli/types/mocha/index.d.ts" />
|
||||
/// <reference path="../../../../../../cli/types/jquery/index.d.ts" />
|
||||
|
||||
/**
|
||||
* This tests the error UI for a certain webpack preprocessor setup.
|
||||
* It does this by having a test fail and then a subsequent test run that
|
||||
@@ -24,7 +30,7 @@ context('validation errors', function () {
|
||||
})
|
||||
|
||||
verify(this, {
|
||||
line: 23,
|
||||
line: 29,
|
||||
column: 8,
|
||||
message: 'can only accept a string preset or',
|
||||
stack: ['throwErrBadArgs', 'From Your Spec Code:'],
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"sourceMap": false,
|
||||
"inlineSourceMap": true,
|
||||
"inlineSources": false,
|
||||
"types": ["cypress"]
|
||||
"typeRoots": ["../../../../cli/types"],
|
||||
// "types": ["cypress"]
|
||||
}
|
||||
}
|
||||
|
||||
7
packages/ui-components/cypress/support/test-entry.scss.d.ts
vendored
Normal file
7
packages/ui-components/cypress/support/test-entry.scss.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
2
packages/web-config/index.d.ts
vendored
Normal file
2
packages/web-config/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference path="../../cli/types/jquery/index.d.ts" />
|
||||
/// <reference path="../../cli/types/mocha/index.d.ts" />
|
||||
@@ -14,6 +14,7 @@
|
||||
"@types/jsdom": "12.2.4",
|
||||
"@types/mock-require": "2.0.0",
|
||||
"@types/webpack": "4.41.0",
|
||||
"@types/webpack-dev-server": "^4.0.0",
|
||||
"ansi-escapes": "4.3.1",
|
||||
"arraybuffer-loader": "1.0.8",
|
||||
"autoprefixer": "9.7.4",
|
||||
@@ -24,6 +25,7 @@
|
||||
"clean-webpack-plugin": "2.0.2",
|
||||
"copy-webpack-plugin": "5.1.2",
|
||||
"css-loader": "2.1.1",
|
||||
"css-modules-typescript-loader": "4.0.1",
|
||||
"execa": "^5.0.0",
|
||||
"extract-text-webpack-plugin": "4.0.0-beta.0",
|
||||
"file-loader": "4.3.0",
|
||||
|
||||
@@ -65,6 +65,13 @@ function makeSassLoaders ({ modules }: { modules: boolean }): RuleSetRule {
|
||||
exclude,
|
||||
enforce: 'pre',
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('css-modules-typescript-loader'),
|
||||
options: {
|
||||
modules: true,
|
||||
mode: process.env.CI ? 'verify' : 'emit',
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: require.resolve('css-loader'),
|
||||
options: {
|
||||
|
||||
39622
patches/@types+jquery+3.3.31.patch
Normal file
39622
patches/@types+jquery+3.3.31.patch
Normal file
File diff suppressed because it is too large
Load Diff
5607
patches/@types+mocha+8.0.3.patch
Normal file
5607
patches/@types+mocha+8.0.3.patch
Normal file
File diff suppressed because it is too large
Load Diff
102
patches/react-vtree+3.0.0-beta.1.patch
Normal file
102
patches/react-vtree+3.0.0-beta.1.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
diff --git a/node_modules/react-vtree/dist/es/Tree.d.ts b/node_modules/react-vtree/dist/es/Tree.d.ts
|
||||
index 5e7f57e..5e764e9 100644
|
||||
--- a/node_modules/react-vtree/dist/es/Tree.d.ts
|
||||
+++ b/node_modules/react-vtree/dist/es/Tree.d.ts
|
||||
@@ -1,6 +1,9 @@
|
||||
import React, { Component, ComponentType, PropsWithChildren, PureComponent, ReactElement, ReactNode, Ref, RefCallback, RefObject } from 'react';
|
||||
import { Align, FixedSizeList, ListChildComponentProps, ListProps, VariableSizeList } from 'react-window';
|
||||
-import { DefaultTreeProps, DefaultTreeState } from './utils';
|
||||
+// import { DefaultTreeProps, DefaultTreeState } from './utils';
|
||||
+interface DefaultTreeProps {}
|
||||
+interface DefaultTreeState {}
|
||||
+
|
||||
export declare type NodeData = Readonly<{
|
||||
/**
|
||||
* Unique ID of the current node.
|
||||
diff --git a/node_modules/react-vtree/dist/es/utils.d.ts b/node_modules/react-vtree/dist/es/utils.d.ts
|
||||
index bb27d60..a4f244f 100644
|
||||
--- a/node_modules/react-vtree/dist/es/utils.d.ts
|
||||
+++ b/node_modules/react-vtree/dist/es/utils.d.ts
|
||||
@@ -1,41 +1,41 @@
|
||||
-/// <reference types="react" />
|
||||
-import { FixedSizeList } from 'react-window';
|
||||
-import type { NodeData, NodePublicState, NodeRecord, TreeCreatorOptions, TreeProps, TreeState, TypedListChildComponentData } from './Tree';
|
||||
-export declare type Mutable<T> = {
|
||||
- -readonly [P in keyof T]: T[P];
|
||||
-};
|
||||
-export declare type RequestIdleCallbackHandle = any;
|
||||
-export declare type RequestIdleCallbackOptions = Readonly<{
|
||||
- timeout: number;
|
||||
-}>;
|
||||
-export declare type RequestIdleCallbackDeadline = Readonly<{
|
||||
- didTimeout: boolean;
|
||||
- timeRemaining: () => number;
|
||||
-}>;
|
||||
-declare global {
|
||||
- const requestIdleCallback: (callback: (deadline: RequestIdleCallbackDeadline) => void, opts?: RequestIdleCallbackOptions) => RequestIdleCallbackHandle;
|
||||
- const cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void;
|
||||
- interface Window {
|
||||
- requestIdleCallback: typeof requestIdleCallback;
|
||||
- cancelIdleCallback: typeof cancelIdleCallback;
|
||||
- }
|
||||
-}
|
||||
-export declare type DefaultTreeProps = TreeProps<NodeData, NodePublicState<NodeData>, FixedSizeList>;
|
||||
-export declare type DefaultTreeState = TreeState<NodeData, NodePublicState<NodeData>, FixedSizeList>;
|
||||
-export declare type DefaultTreeCreatorOptions = TreeCreatorOptions<NodeData, NodePublicState<NodeData>, DefaultTreeState>;
|
||||
-export declare const noop: () => void;
|
||||
-export declare const identity: <T>(value: T) => T;
|
||||
-export declare const createBasicRecord: <TData extends Readonly<{
|
||||
- id: string;
|
||||
- isOpenByDefault: boolean;
|
||||
-}>, TNodePublicState extends NodePublicState<TData>>(pub: TNodePublicState, parent?: NodeRecord<TNodePublicState> | null) => NodeRecord<TNodePublicState>;
|
||||
-export declare const getIdByIndex: <TData extends Readonly<{
|
||||
- id: string;
|
||||
- isOpenByDefault: boolean;
|
||||
-}>, TNodePublicState extends NodePublicState<TData>>(index: number, { getRecordData }: Readonly<{
|
||||
- component: import("react").ComponentType<Readonly<Pick<import("react-window").ListChildComponentProps, "style" | "isScrolling"> & TNodePublicState & {
|
||||
- treeData?: any;
|
||||
- }>>;
|
||||
- getRecordData: (index: number) => TNodePublicState;
|
||||
- treeData: any;
|
||||
-}>) => string;
|
||||
+// /// <reference types="react" />
|
||||
+// import { FixedSizeList } from 'react-window';
|
||||
+// import type { NodeData, NodePublicState, NodeRecord, TreeCreatorOptions, TreeProps, TreeState, TypedListChildComponentData } from './Tree';
|
||||
+// export declare type Mutable<T> = {
|
||||
+// -readonly [P in keyof T]: T[P];
|
||||
+// };
|
||||
+// export declare type RequestIdleCallbackHandle = any;
|
||||
+// export declare type RequestIdleCallbackOptions = Readonly<{
|
||||
+// timeout: number;
|
||||
+// }>;
|
||||
+// export declare type RequestIdleCallbackDeadline = Readonly<{
|
||||
+// didTimeout: boolean;
|
||||
+// timeRemaining: () => number;
|
||||
+// }>;
|
||||
+// declare global {
|
||||
+// const requestIdleCallback: (callback: (deadline: RequestIdleCallbackDeadline) => void, opts?: RequestIdleCallbackOptions) => RequestIdleCallbackHandle;
|
||||
+// const cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void;
|
||||
+// interface Window {
|
||||
+// requestIdleCallback: typeof requestIdleCallback;
|
||||
+// cancelIdleCallback: typeof cancelIdleCallback;
|
||||
+// }
|
||||
+// }
|
||||
+// export declare type DefaultTreeProps = TreeProps<NodeData, NodePublicState<NodeData>, FixedSizeList>;
|
||||
+// export declare type DefaultTreeState = TreeState<NodeData, NodePublicState<NodeData>, FixedSizeList>;
|
||||
+// export declare type DefaultTreeCreatorOptions = TreeCreatorOptions<NodeData, NodePublicState<NodeData>, DefaultTreeState>;
|
||||
+// export declare const noop: () => void;
|
||||
+// export declare const identity: <T>(value: T) => T;
|
||||
+// export declare const createBasicRecord: <TData extends Readonly<{
|
||||
+// id: string;
|
||||
+// isOpenByDefault: boolean;
|
||||
+// }>, TNodePublicState extends NodePublicState<TData>>(pub: TNodePublicState, parent?: NodeRecord<TNodePublicState> | null) => NodeRecord<TNodePublicState>;
|
||||
+// export declare const getIdByIndex: <TData extends Readonly<{
|
||||
+// id: string;
|
||||
+// isOpenByDefault: boolean;
|
||||
+// }>, TNodePublicState extends NodePublicState<TData>>(index: number, { getRecordData }: Readonly<{
|
||||
+// component: import("react").ComponentType<Readonly<Pick<import("react-window").ListChildComponentProps, "style" | "isScrolling"> & TNodePublicState & {
|
||||
+// treeData?: any;
|
||||
+// }>>;
|
||||
+// getRecordData: (index: number) => TNodePublicState;
|
||||
+// treeData: any;
|
||||
+// }>) => string;
|
||||
@@ -41,6 +41,7 @@ program
|
||||
})
|
||||
}
|
||||
|
||||
const tsc = require.resolve('typescript/bin/tsc')
|
||||
const options = ['--noEmit', '--pretty']
|
||||
|
||||
if (program.skipLibCheck) {
|
||||
@@ -49,39 +50,28 @@ program
|
||||
|
||||
const tasks = new Listr(projects.map((proj) => {
|
||||
return {
|
||||
options: { title: proj.name },
|
||||
title: proj.name,
|
||||
task: () => {
|
||||
const cwd = proj.path
|
||||
const tsc = require.resolve('typescript/bin/tsc')
|
||||
|
||||
return execa(tsc, options, {
|
||||
cwd,
|
||||
}).catch((err) => {
|
||||
throw {
|
||||
name: proj.name,
|
||||
err,
|
||||
}
|
||||
})
|
||||
return execa(tsc, options, { cwd: proj.path })
|
||||
},
|
||||
}
|
||||
}), {
|
||||
concurrent: 4,
|
||||
concurrent: process.env.CI ? 4 : 1,
|
||||
renderer: process.env.CI ? 'verbose' : 'default',
|
||||
exitOnError: false,
|
||||
renderer: program.ignoreProgress ? 'silent' : 'default',
|
||||
})
|
||||
|
||||
tasks.run()
|
||||
.then(() => {
|
||||
log('')
|
||||
log('Type check passed successfully.')
|
||||
})
|
||||
.catch((err) => {
|
||||
process.exitCode = 1
|
||||
if (tasks.err[0] && tasks.err[0].errors.length > 0) {
|
||||
process.exitCode = 1
|
||||
|
||||
err.errors.forEach((e) => {
|
||||
log('')
|
||||
log(`${e.name} failed\n${e.err.stdout}`)
|
||||
})
|
||||
log('Type check failed.')
|
||||
} else {
|
||||
log('')
|
||||
log('Type check passed successfully.')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
78
yarn.lock
78
yarn.lock
@@ -7944,6 +7944,13 @@
|
||||
dependencies:
|
||||
"@types/istanbul-lib-report" "*"
|
||||
|
||||
"@types/jquery.scrollto@1.4.29":
|
||||
version "1.4.29"
|
||||
resolved "https://registry.yarnpkg.com/@types/jquery.scrollto/-/jquery.scrollto-1.4.29.tgz#a3cdbe757249c08740dc4c36d83bf3c041e315cc"
|
||||
integrity sha512-4AGdSgD6BDFcz53My+gtmsqbQFl72V7bc5YqhUw9jZTpx1w9ZiQqdvFyRU/DXSuBDG+pif8FL3geaKM7ZDGngw==
|
||||
dependencies:
|
||||
"@types/jquery" "*"
|
||||
|
||||
"@types/jquery@*", "@types/jquery@3.3.31":
|
||||
version "3.3.31"
|
||||
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.31.tgz#27c706e4bf488474e1cb54a71d8303f37c93451b"
|
||||
@@ -8025,14 +8032,12 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a"
|
||||
integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==
|
||||
|
||||
"@types/mini-css-extract-plugin@1.4.2":
|
||||
version "1.4.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/mini-css-extract-plugin/-/mini-css-extract-plugin-1.4.2.tgz#79b562f6977d8d692190d81c4ba890826a0761e1"
|
||||
integrity sha512-jAE5X6kO8+0ByUqzqUaOz9z/dilUKOBNcmNXAETJM9Ak9VopBqWZo+ISqILJnxh6/E/Ci6i2xAUydq2w6vE69g==
|
||||
"@types/mini-css-extract-plugin@1.2.3":
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/mini-css-extract-plugin/-/mini-css-extract-plugin-1.2.3.tgz#199037f2f3e11fa0fa3e7606d762a6cd56a22785"
|
||||
integrity sha512-kWuO6PeoOqlxaP+6NCSfM7x+NowqXwLnS03w/G6gYYhOviIx5bC3jeOhp5zloqe75pNJuBxfuJPKN+ABc4Xklw==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
tapable "^2.2.0"
|
||||
webpack "^5"
|
||||
"@types/webpack" "^4"
|
||||
|
||||
"@types/minimatch@*":
|
||||
version "3.0.4"
|
||||
@@ -8049,16 +8054,6 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256"
|
||||
integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg==
|
||||
|
||||
"@types/mocha@5.2.7":
|
||||
version "5.2.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.7.tgz#315d570ccb56c53452ff8638738df60726d5b6ea"
|
||||
integrity sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==
|
||||
|
||||
"@types/mocha@7.0.2":
|
||||
version "7.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-7.0.2.tgz#b17f16cf933597e10d6d78eae3251e692ce8b0ce"
|
||||
integrity sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==
|
||||
|
||||
"@types/mocha@8.0.3", "@types/mocha@^8.0.2", "@types/mocha@^8.0.3":
|
||||
version "8.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.0.3.tgz#51b21b6acb6d1b923bbdc7725c38f9f455166402"
|
||||
@@ -8402,6 +8397,18 @@
|
||||
dependencies:
|
||||
source-map "^0.6.1"
|
||||
|
||||
"@types/underscore.string@0.0.38":
|
||||
version "0.0.38"
|
||||
resolved "https://registry.yarnpkg.com/@types/underscore.string/-/underscore.string-0.0.38.tgz#4081755f005f5691fb7fbd4eff3aabe6066a6c63"
|
||||
integrity sha512-QPMttDInBYkulH/3nON0KnYpEd/RlyE5kUrhuts5d76B/stpjXpDticq+iTluoAsVnVXuGECFhPtuX+aDJdx+A==
|
||||
dependencies:
|
||||
"@types/underscore" "*"
|
||||
|
||||
"@types/underscore@*":
|
||||
version "1.11.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/underscore/-/underscore-1.11.3.tgz#d6734f3741ce41b2630018c6b61c6745f6188c07"
|
||||
integrity sha512-Fl1TX1dapfXyDqFg2ic9M+vlXRktcPJrc4PR7sRc7sdVrjavg/JHlbUXBt8qWWqhJrmSqg3RNAkAPRiOYw6Ahw==
|
||||
|
||||
"@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2", "@types/unist@^2.0.3":
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e"
|
||||
@@ -15419,6 +15426,14 @@ css-modules-loader-core@^1.1.0:
|
||||
postcss-modules-scope "1.1.0"
|
||||
postcss-modules-values "1.3.0"
|
||||
|
||||
css-modules-typescript-loader@4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/css-modules-typescript-loader/-/css-modules-typescript-loader-4.0.1.tgz#0b818cf647fefd8f9fb3d4469374e69ab1e72742"
|
||||
integrity sha512-vXrUAwPGcRaopnGdg7I5oqv/NSSKQRN5L80m3f49uSGinenU5DTNsMFHS+2roh5tXqpY5+yAAKAl7A2HDvumzg==
|
||||
dependencies:
|
||||
line-diff "^2.0.1"
|
||||
loader-utils "^1.2.3"
|
||||
|
||||
css-node-extract@^2.1.3:
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/css-node-extract/-/css-node-extract-2.1.3.tgz#ec388a857b8fdf13fefd94b3da733257162405da"
|
||||
@@ -19387,7 +19402,7 @@ find-webpack@2.2.1:
|
||||
find-yarn-workspace-root "1.2.1"
|
||||
mocked-env "1.3.2"
|
||||
|
||||
find-yarn-workspace-root@1.2.1, find-yarn-workspace-root@^1.2.1:
|
||||
find-yarn-workspace-root@1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-1.2.1.tgz#40eb8e6e7c2502ddfaa2577c176f221422f860db"
|
||||
integrity sha512-dVtfb0WuQG+8Ag2uWkbG79hOUzEsRrhBzgfn86g2sJPkzmcpGdghbNTfUKGTxymFrY/tLIodDzLoW9nOJ4FY8Q==
|
||||
@@ -19395,7 +19410,7 @@ find-yarn-workspace-root@1.2.1, find-yarn-workspace-root@^1.2.1:
|
||||
fs-extra "^4.0.3"
|
||||
micromatch "^3.1.4"
|
||||
|
||||
find-yarn-workspace-root@2.0.0:
|
||||
find-yarn-workspace-root@2.0.0, find-yarn-workspace-root@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd"
|
||||
integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==
|
||||
@@ -25161,6 +25176,11 @@ less@4.1.1:
|
||||
needle "^2.5.2"
|
||||
source-map "~0.6.0"
|
||||
|
||||
levdist@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/levdist/-/levdist-1.0.0.tgz#91d7a3044964f2ccc421a0477cac827fe75c5718"
|
||||
integrity sha1-kdejBElk8szEIaBHfKyCf+dcVxg=
|
||||
|
||||
level-blobs@^0.1.7:
|
||||
version "0.1.7"
|
||||
resolved "https://registry.yarnpkg.com/level-blobs/-/level-blobs-0.1.7.tgz#9ab9b97bb99f1edbf9f78a3433e21ed56386bdaf"
|
||||
@@ -25443,6 +25463,13 @@ line-column@^1.0.2:
|
||||
isarray "^1.0.0"
|
||||
isobject "^2.0.0"
|
||||
|
||||
line-diff@^2.0.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/line-diff/-/line-diff-2.1.1.tgz#a389799b931375a3b1e764964ad0b0b3ce60d6f6"
|
||||
integrity sha512-vswdynAI5AMPJacOo2o+JJ4caDJbnY2NEqms4MhMW0NJbjh3skP/brpVTAgBxrg55NRZ2Vtw88ef18hnagIpYQ==
|
||||
dependencies:
|
||||
levdist "^1.0.0"
|
||||
|
||||
lines-and-columns@^1.1.6:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
|
||||
@@ -29035,7 +29062,7 @@ open@^6.3.0:
|
||||
dependencies:
|
||||
is-wsl "^1.1.0"
|
||||
|
||||
open@^7.0.2, open@^7.0.3:
|
||||
open@^7.0.2, open@^7.0.3, open@^7.4.2:
|
||||
version "7.4.2"
|
||||
resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321"
|
||||
integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==
|
||||
@@ -29869,19 +29896,20 @@ pascalcase@^0.1.1:
|
||||
resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14"
|
||||
integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=
|
||||
|
||||
patch-package@6.2.2:
|
||||
version "6.2.2"
|
||||
resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.2.2.tgz#71d170d650c65c26556f0d0fbbb48d92b6cc5f39"
|
||||
integrity sha512-YqScVYkVcClUY0v8fF0kWOjDYopzIM8e3bj/RU1DPeEF14+dCGm6UeOYm4jvCyxqIEQ5/eJzmbWfDWnUleFNMg==
|
||||
patch-package@6.4.7:
|
||||
version "6.4.7"
|
||||
resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.4.7.tgz#2282d53c397909a0d9ef92dae3fdeb558382b148"
|
||||
integrity sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ==
|
||||
dependencies:
|
||||
"@yarnpkg/lockfile" "^1.1.0"
|
||||
chalk "^2.4.2"
|
||||
cross-spawn "^6.0.5"
|
||||
find-yarn-workspace-root "^1.2.1"
|
||||
find-yarn-workspace-root "^2.0.0"
|
||||
fs-extra "^7.0.1"
|
||||
is-ci "^2.0.0"
|
||||
klaw-sync "^6.0.0"
|
||||
minimist "^1.2.0"
|
||||
open "^7.4.2"
|
||||
rimraf "^2.6.3"
|
||||
semver "^5.6.0"
|
||||
slash "^2.0.0"
|
||||
|
||||
Reference in New Issue
Block a user