chore: Remove unused exports + remove 'export' from internal functions + fix circular dep + other dev fixes (#33212)

* remove some unused exports

* Address more unused exports

* remove more unused exports

* remove duplicate unused file

* remove more unused exports

* remove more unused code

* remove unused files and imports

* fix spelling of functions

* more updated

* fix circular dep

* Remove unused type dep + fix types/node version

* Fix circular dep in Lerna build

* bump eslint-plugin-react to work with eslint 8

* ignore webpack esm-utils warning

* remove unused dependency
This commit is contained in:
Jennifer Shehane
2026-01-09 10:45:32 -05:00
committed by GitHub
parent be040aaf8e
commit 530b0dd3e2
107 changed files with 263 additions and 839 deletions
+2 -1
View File
@@ -7,6 +7,7 @@
"ignore": [
"packages/data-context/src/gen",
"packages/data-context/graphql/stitching",
"packages/data-context/graphql/testing"
"packages/data-context/graphql/testing",
"packages/data-context/graphql/utils"
]
}
+2 -3
View File
@@ -12,7 +12,7 @@ const runDocumentationUrl = `${docsUrl}/cypress-run`
// TODO it would be nice if all error objects could be enforced via types
// to only have description + solution properties
export const hr = '----------'
const hr = '----------'
const genericErrorSolution = stripIndent`
Search for an existing issue or open a GitHub issue at
@@ -360,7 +360,7 @@ export async function formErrorText (info: any, msg?: string, prevMessage?: stri
return formatted.join('\n\n')
}
export const raise = (info: any) => {
const raise = (info: any) => {
return (text: string) => {
const err: any = new Error(text)
@@ -391,7 +391,6 @@ export const exitWithError = (info: any) => {
return async (msg?: string) => {
const text: string = await formErrorText(info, msg)
// eslint-disable-next-line no-console
console.error(text)
process.exit(info.exitCode || 1)
}
+2 -2
View File
@@ -16,7 +16,7 @@ const debug = Debug('cypress:cli')
*
* @returns {string[]} list of CLI arguments
*/
export const processOpenOptions = (options: any = {}): string[] => {
const processOpenOptions = (options: any = {}): string[] => {
// In addition to setting the project directory, setting the project option
// here ultimately decides whether cypress is run in global mode or not.
// It's first based off whether it's installed globally by npm/yarn (-g).
@@ -74,7 +74,7 @@ export const processOpenOptions = (options: any = {}): string[] => {
return args
}
export const start = async (options: any = {}): Promise<any> => {
const start = async (options: any = {}): Promise<any> => {
function open (): any {
try {
const args = processOpenOptions(options)
+67 -9
View File
@@ -113,7 +113,6 @@
"lib/capture.ts",
"lib/runner-ct.ts",
"lib/cloud/artifacts/upload_artifacts.ts",
"lib/cloud/network/nonretriable_cert_error_codes.ts",
"lib/plugins/child/default_plugins_file.js",
"lib/privileged-commands/privileged-channel.js",
"lib/util/**/*.{ts,js}",
@@ -246,6 +245,8 @@
},
"packages/driver": {
"entry": [
"src/main.ts",
"src/cypress/commands.ts",
"cypress/plugins/server.js",
"cypress/plugins/index.js",
"cypress.config.ts",
@@ -285,8 +286,13 @@
]
},
"packages/proxy": {
"entry": [
"lib/http/util/rewriter.ts",
"test/**/*.{ts,tsx,js,jsx}"
],
"project": [
"lib/**/*.{ts,tsx,js,jsx}",
"test/**/*.{ts,tsx,js,jsx}",
"*.{ts,tsx,js,jsx}"
]
},
@@ -298,6 +304,10 @@
]
},
"packages/launcher": {
"entry": [
"index.ts",
"lib/detect.ts"
],
"project": [
"lib/**/*.{ts,tsx,js,jsx}",
"*.{ts,tsx,js,jsx}"
@@ -316,6 +326,7 @@
},
"packages/network": {
"entry": [
"lib/index.ts",
"test/support/servers.ts",
"test/**/*.{ts,tsx,js,jsx}"
],
@@ -393,6 +404,9 @@
]
},
"packages/network-tools": {
"entry": [
"lib/index.ts"
],
"project": [
"lib/**/*.{ts,tsx,js,jsx}"
]
@@ -656,6 +670,8 @@
"**/__snapshots__/**",
"**/cypress.config.{ts,js}",
"**/cypress.config-*.{ts,js}",
"**/cypress/support/component.{js,jsx,ts,tsx}",
"**/cypress/types.d.ts",
"**/.releaserc.js",
"**/index.d.ts",
"**/postcss.config.{js,ts,cjs,mjs}",
@@ -722,14 +738,56 @@
"wc"
],
"rules": {
"files": "warn",
"dependencies": "error",
"unlisted": "error",
"unresolved": "warn",
"exports": "warn",
"types": "warn",
"duplicates": "warn",
"binaries": "warn",
"catalog": "warn",
"classMembers": "warn",
"enumMembers": "warn"
"dependencies": "error",
"duplicates": "warn",
"enumMembers": "warn",
"exports": "warn",
"nsExports": "warn",
"nsTypes": "warn",
"files": "warn",
"types": "warn",
"unlisted": "error",
"unresolved": "off"
},
"ignoreIssues": {
"cli/types/cy-blob-util.d.ts": [
"exports"
],
"cli/types/cy-bluebird.d.ts": [
"exports"
],
"cli/types/cy-minimatch.d.ts": [
"exports"
],
"packages/launcher/lib/darwin/index.ts": [
"exports"
],
"packages/launcher/lib/windows/index.ts": [
"exports"
],
"packages/server/lib/cloud/protocol.ts": [
"exports"
],
"packages/server/lib/plugins/child/cross_origin.js": [
"exports"
],
"packages/server/lib/plugins/child/dev-server.js": [
"exports"
],
"packages/server/lib/video_capture.ts": [
"exports"
],
"packages/data-context/graphql/index.ts": [
"exports"
],
"packages/net-stubbing/lib/external-types.ts": [
"exports"
],
"npm/react/cypress/component/advanced/lazy-loaded-suspense/Dog.tsx": [
"exports"
]
}
}
-1
View File
@@ -20,7 +20,6 @@
"@angular-devkit/schematics": "^21.0.4",
"@angular-devkit/schematics-cli": "^21.0.4",
"@schematics/angular": "^21.0.4",
"@types/chai-enzyme": "0.6.14",
"@types/mocha": "8.0.3",
"@types/node": "^22.18.7",
"eslint": "^9.31.0",
@@ -1,163 +0,0 @@
const sh = require('shelljs')
const sinon = require('sinon')
const lintStaged = require('./lint-staged')
const lintChanged = require('./lint-changed')
const lintPrePush = require('./lint-pre-push')
const lintPreCommit = require('./lint-pre-commit')
const chai = require('chai')
const debug = require('debug')('lint.spec')
const { expect } = chai
chai.use(require('sinon-chai'))
const _env = process.env
const _argv = process.argv
const getStagedFiles = () => sh.ShellString('foo.js\nbar.js')
const getUnstagedFiles = () => sh.ShellString('bar.js\nbaz.js')
const getCommittedFiles = () => sh.ShellString('baz.js\nquux.js')
const eslintSuccess = (...args) => {
debug('eslintSuccess:', args)
const ret = sh.ShellString(`GOOD JS`)
ret.exec = sinon.stub().yields(null, 'success')
return ret
}
const eslintFailure = (...args) => {
debug('eslintFailure:', args)
const ret = sh.ShellString(`BAD JS`)
ret.exec = sinon.stub().yields('foo error')
return ret
}
beforeEach(() => {
sinon.stub(sh, 'exec')
sinon.stub(sh, 'cat')
sinon.stub(process, 'exit')
sh.exec
.withArgs(`git branch`).returns(sh.ShellString('* mybranch'))
.withArgs(`git diff --name-only --diff-filter=MA --staged`)
.returns(getStagedFiles())
.withArgs(`git diff --name-only --diff-filter=M`)
.returns(getUnstagedFiles())
.withArgs(`git diff HEAD origin/mybranch --name-only`)
.returns(getCommittedFiles())
sh.exec.callsFake(eslintSuccess)
})
describe('lint-staged', () => {
it('lint success', async () => {
await lintStaged.start()
expect(process.exit).not.calledOnce
})
it('lint failures', async () => {
sh.exec.callsFake(eslintFailure)
await lintStaged.start()
expect(process.exit).calledOnce
})
})
describe('lint-changed', () => {
const filenames = 'bar.js baz.js foo.js'
beforeEach(() => {
sh.exec
.withArgs(`./node_modules/.bin/eslint --color=true '' ${filenames}`)
.yields(null, 'success')
})
it('lint success', async () => {
await lintChanged.start()
expect(process.exit).not.calledOnce
})
it('lint failures', async () => {
sh.exec
.withArgs(`./node_modules/.bin/eslint --color=true '' ${filenames}`)
.yields('foo error')
await lintChanged.start()
expect(process.exit).calledOnce
})
it('lint with --fix', async () => {
process.argv = ['_', '_', '--fix']
sh.exec
.withArgs(`./node_modules/.bin/eslint --color=true --fix '' ${filenames}`)
.yields(null, 'success')
await lintChanged.start()
expect(process.exit).not.calledOnce
})
})
describe('lint-pre-push', () => {
beforeEach(() => {
process.env.HUSKY_GIT_PARAMS = 'origin git@github.com:cypress-io/cypress.git'
})
it('lint success', async () => {
await lintPrePush.start()
expect(process.exit).not.calledOnce
})
it('lint failures', async () => {
sh.exec.callsFake(eslintFailure)
await lintPrePush.start()
expect(process.exit).calledOnce
})
})
describe('lint-pre-commit', () => {
beforeEach(() => {
sh.exec
.withArgs(`./node_modules/.bin/eslint --color=true --fix '' foo.js`)
.yields(null, 'success')
})
it('lint success', async () => {
await lintPreCommit.start()
expect(process.exit).not.calledOnce
expect(sh.exec.withArgs('git add foo.js')).calledOnce
})
it('lint failures', async () => {
sh.exec.callsFake(eslintFailure)
await lintPreCommit.start()
expect(process.exit).calledOnce
})
})
afterEach(() => {
process.argv = _argv
process.env = _env
sinon.restore()
})
// sinon.addBehavior('withArgIncludes', (stub, str) => {
// })
// function withArgsInclude() {
// this.
// .callsFake((...args) => {
// args[0].includes()
// })
// }
+2 -2
View File
@@ -4,11 +4,11 @@ import { getContainerEl } from '@cypress/mount-utils'
import {
makeMountFn,
makeUnmountFn,
} from './index'
} from './createMount'
import type {
MountOptions,
InternalMountOptions,
} from './index'
} from './types'
let root: ReactDOM.Root | null
+2 -3
View File
@@ -4,14 +4,13 @@ const config = {
external: [
'vue',
'@vue/compiler-dom',
'@vue/server-renderer'
'@vue/server-renderer',
],
output: {
globals: {
vue: 'Vue',
vue: 'Vue',
'@vue/compiler-dom': 'VueCompilerDOM',
'@vue/server-renderer': 'VueServerRenderer'
'@vue/server-renderer': 'VueServerRenderer',
},
},
}
+1 -4
View File
@@ -83,7 +83,6 @@
"@cypress/request-promise": "^5.0.0",
"@electron/fuses": "1.8.0",
"@electron/notarize": "^2.5.0",
"@fellow/eslint-plugin-coffee": "0.4.13",
"@graphql-codegen/add": "3.1.0",
"@graphql-codegen/cli": "2.2.0",
"@graphql-codegen/plugin-helpers": "2.3.2",
@@ -103,7 +102,6 @@
"@semantic-release/git": "10.0.1",
"@types/better-sqlite3": "^7.6.13",
"@types/bluebird": "3.5.29",
"@types/chai-enzyme": "0.6.14",
"@types/debug": "4.1.7",
"@types/fluent-ffmpeg": "^2.1.18",
"@types/fs-extra": "^9.0.13",
@@ -148,7 +146,7 @@
"eslint-plugin-import": "2.25.4",
"eslint-plugin-json-format": "2.0.1",
"eslint-plugin-mocha": "8.2.0",
"eslint-plugin-react": "7.22.0",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "4.2.0",
"eslint-plugin-vue": "7.18.0",
"execa": "4.1.0",
@@ -264,7 +262,6 @@
},
"resolutions": {
"**/@types/cheerio": "0.22.35",
"**/@types/enzyme": "3.10.19",
"**/@types/node": "22.18.7",
"**/form-data": "^4.0.4",
"**/jquery": "3.7.1",
+1 -6
View File
@@ -87,10 +87,5 @@
"files": [
"dist"
],
"license": "MIT",
"nx": {
"implicitDependencies": [
"@packages/data-context"
]
}
"license": "MIT"
}
@@ -1,24 +0,0 @@
import { RequestAccessComposable_RequestAccessDocument } from '../generated/graphql'
import { gql, useMutation } from '@urql/vue'
gql`
mutation RequestAccessComposable_RequestAccess( $projectId: String! ) {
cloudProjectRequestAccess(projectSlug: $projectId) {
__typename
... on CloudProjectUnauthorized {
message
hasRequestedAccess
}
}
}
`
export function useRequestAccess () {
const requestAccessMutation = useMutation(RequestAccessComposable_RequestAccessDocument)
return async function requestAccess (projectId: string | null | undefined) {
if (projectId) {
await requestAccessMutation.executeMutation({ projectId })
}
}
}
+1 -1
View File
@@ -2,7 +2,7 @@ import { getOffset } from './dimensions'
export const INT32_MAX = 2147483647
export function getZIndex (el) {
function getZIndex (el) {
const value = getComputedStyle(el, null).getPropertyValue('z-index')
if (/^(auto|0)$/.test(value)) {
+2 -2
View File
@@ -44,7 +44,7 @@ export function createWebsocket (config: Cypress.Config) {
return ws
}
export function initializeEventManager (UnifiedRunner: any) {
function initializeEventManager (UnifiedRunner: any) {
if (!window.ws) {
throw Error('Need window.ws to exist before initializing event manager')
}
@@ -187,7 +187,7 @@ function teardownSpec (isRerun: boolean = false) {
* This will teardown the reporter, event manager, and
* any associated events.
*/
export async function teardown () {
async function teardown () {
UnifiedReporterAPI.setInitializedReporter(false)
_eventManager?.stop()
await _eventManager?.teardown(getMobxRunnerStore())
+1 -1
View File
@@ -7,7 +7,7 @@ import { useRunnerUiStore } from '../store/runner-ui-store'
let hasInitializeReporter = false
let reactDomRoot: any = null
export function setInitializedReporter (val: boolean) {
function setInitializedReporter (val: boolean) {
hasInitializeReporter = val
}
@@ -1,29 +0,0 @@
<template>
<button class="relative">
<div class="option get">
cy.get
</div>
<div class="option contains">
cy.contains
</div>
</button>
</template>
<script lang="ts" setup>
</script>
<style scoped>
.option {
height: 24px;
@apply absolute;
}
.get {
top: 0px;
}
.contains {
top: 24px;
}
</style>
+3 -3
View File
@@ -11,13 +11,13 @@ export interface AssertionType {
export type PossibleAssertions = AssertionType[]
// Single argument assertion: ['be.visible']
export type AssertionArgs_1 = [string]
type AssertionArgs_1 = [string]
// Two argument assertion: ['have.text', '<some text>']
export type AssertionArgs_2 = [string, string]
type AssertionArgs_2 = [string, string]
// Three argument assertion: ['have.attr', 'href', '<some value>']
export type AssertionArgs_3 = [string, string, string]
type AssertionArgs_3 = [string, string, string]
export type AssertionArgs = AssertionArgs_1 | AssertionArgs_2 | AssertionArgs_3
@@ -43,7 +43,7 @@ import { useI18n } from '@cy/i18n'
import { useMarkdown } from '@packages/frontend-shared/src/composables/useMarkdown'
import { ref } from 'vue'
export interface Experiment {
interface Experiment {
key: string
name: string
description: string
@@ -39,7 +39,7 @@ import SettingsSection from '../SettingsSection.vue'
import ExternalLink from '@cy/gql-components/ExternalLink.vue'
import type { ExperimentsFragment } from '../../generated/graphql'
import { useI18n } from '@cy/i18n'
import type { CypressResolvedConfig } from './projectSettings'
import type { CypressResolvedConfig } from '@packages/types/src/config'
const { t } = useI18n()
gql`
@@ -1,22 +0,0 @@
export const sections = {
project: [
{
title: 'Experiments',
description: 'Enable or disable experiments',
},
],
user: {},
}
export interface Experiment {
name: string
description: string
enabled: boolean
key: string
}
export type CypressResolvedConfig = Array<{
field: string
from: 'default'| 'config' | 'plugin' | 'env'
value: string | number | boolean | Record<string, string> | Array<string>
}>
+1 -1
View File
@@ -13,7 +13,7 @@ export * from './scaffold'
export * from './empty'
export const generatorList: SpecGenerator[] = [
const generatorList: SpecGenerator[] = [
VueComponentGenerator,
ReactComponentGenerator,
ScaffoldGenerator,
@@ -4,7 +4,7 @@ import { useToggle } from '@vueuse/core'
import type { FoundSpec } from '@packages/types/src'
import { getRunnerConfigFromWindow } from '../../runner/get-runner-config-from-window'
export type RawNode <T> = {
type RawNode <T> = {
id: string
name: string
children: RawNode<T>[]
@@ -84,7 +84,7 @@ function getHighlightIndexes <T extends FoundSpec> (node: SpecTreeNode<T>) {
return res.map((idx) => idx - minIndex)
}
export function buildSpecTreeRecursive<T extends FoundSpec> (path: string, tree: SpecTreeNode<T>, data?: T) {
function buildSpecTreeRecursive<T extends FoundSpec> (path: string, tree: SpecTreeNode<T>, data?: T) {
const [firstFile, ...rest] = path.split(getRegexSeparator())
const id = tree.id ? [tree.id, firstFile].join(getSeparator()) : firstFile
@@ -148,7 +148,7 @@ export type UseCollapsibleTreeNode <T extends RawNode<T>> = {
children: UseCollapsibleTreeNode<T>[]
} & { [K in keyof T]: T[K]}
export interface UseCollapsibleTreeOptions {
interface UseCollapsibleTreeOptions {
expandInitially?: boolean
dropRoot?: boolean
/**
@@ -171,7 +171,7 @@ function collectRoots<T extends RawNode<T>> (node: UseCollapsibleTreeNode<T> | n
return acc
}
export const useCollapsibleTreeNode = <T extends RawNode<T>>(rawNode: T, options: UseCollapsibleTreeOptions, depth: number, parent: UseCollapsibleTreeNode<T> | null): UseCollapsibleTreeNode<T> => {
function useCollapsibleTreeNode <T extends RawNode<T>> (rawNode: T, options: UseCollapsibleTreeOptions, depth: number, parent: UseCollapsibleTreeNode<T> | null): UseCollapsibleTreeNode<T> {
const { cache, expandInitially } = options
const treeNode = rawNode as UseCollapsibleTreeNode<T>
const roots = parent ? collectRoots<T>(parent) : []
@@ -6,7 +6,7 @@ import { isEqual } from 'lodash'
export type UseVirtualListApi = ReturnType<typeof useVirtualList>['api']
export interface UseVirtualListOptions {
interface UseVirtualListOptions {
/**
* item height, accept a pixel value or a function that returns the height
*
@@ -21,7 +21,7 @@ export interface UseVirtualListOptions {
overscan?: number
}
export type UseVirtualListItem<T> = {
type UseVirtualListItem<T> = {
data: T
index: number
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
export interface ScreenshotStore {
interface ScreenshotStore {
isScreenshotting: boolean
}
@@ -1,6 +1,5 @@
import { defineStore } from 'pinia'
type SelectorMethod = 'get' | 'contains'
import type { SelectorMethod } from '../runner/selector-playground/utils'
interface SelectorPlaygroundStore {
show: boolean
@@ -55,7 +55,7 @@ export async function addToCypressConfig (filePath: string, code: string, toAdd:
}
}
export interface AddProjectIdToCypressConfigOptions {
interface AddProjectIdToCypressConfigOptions {
filePath: string
projectId: string
}
@@ -81,7 +81,7 @@ export async function addProjectIdToCypressConfig (options: AddProjectIdToCypres
}
}
export interface AddToCypressConfigResult {
interface AddToCypressConfigResult {
result: 'ADDED' | 'MERGED' | 'NEEDS_MERGE'
error?: Error
codeToMerge?: string
+2 -2
View File
@@ -80,11 +80,11 @@ const CYPRESS_ENV_PREFIX = 'CYPRESS_'
const CYPRESS_ENV_PREFIX_LENGTH = CYPRESS_ENV_PREFIX.length
export const CYPRESS_RESERVED_ENV_VARS = [
const CYPRESS_RESERVED_ENV_VARS = [
'CYPRESS_INTERNAL_ENV',
]
export const CYPRESS_SPECIAL_ENV_VARS = [
const CYPRESS_SPECIAL_ENV_VARS = [
'RECORD_KEY',
]
-4
View File
@@ -1,7 +1,3 @@
export { graphqlSchema } from './schema'
export { execute, parse, print } from 'graphql'
export { remoteSchemaWrapped } from './stitching/remoteSchemaWrapped'
export type { RemoteExecutionRoot } from './stitching/remoteSchemaWrapped'
@@ -45,7 +45,7 @@ export type RemoteFieldDefinitionConfig<TypeName extends string, FieldName exten
} & AdditionalRemoteFieldProps<TypeName, FieldName, RemoteField>
// If not every member of CloudQueryArgs is provided, then we will not issue the request
export type AdditionalRemoteFieldProps<TypeName extends string, FieldName extends string, RemoteField extends CloudQueryFields> = RemoteField extends never ? {
type AdditionalRemoteFieldProps<TypeName extends string, FieldName extends string, RemoteField extends CloudQueryFields> = RemoteField extends never ? {
queryArgs?: RemoteQueryArgsResolver<TypeName, FieldName, any>
} : {
queryArgs: RemoteQueryArgsResolver<TypeName, FieldName, RemoteField>
@@ -1,5 +0,0 @@
/* eslint-disable padding-line-between-statements */
// created by autobarrel, do not modify directly
export * from './graphqlTypeUtils'
export * from './nexusTypegenUtils'
@@ -3,8 +3,6 @@
import { spawn, execSync } from 'child_process'
import chalk from 'chalk'
import pDefer from 'p-defer'
import chokidar from 'chokidar'
import _ from 'lodash'
import path from 'path'
import fs from 'fs-extra'
@@ -33,7 +31,7 @@ async function windowsTouch (filename: string, time: Date) {
}
}
export async function nexusTypegen (cfg: NexusTypegenCfg) {
async function nexusTypegen (cfg: NexusTypegenCfg) {
const dfd = pDefer()
if (cfg.outputPath) {
@@ -86,41 +84,6 @@ export async function nexusTypegen (cfg: NexusTypegenCfg) {
return dfd.promise
}
let debounced: Record<string, Function> = {}
const nexusTypegenDebounced = (cfg: NexusTypegenCfg) => {
debounced[cfg.filePath] =
debounced[cfg.filePath] ?? _.debounce(nexusTypegen, 500)
debounced[cfg.filePath]?.(cfg)
}
interface NexusTypegenWatchCfg extends NexusTypegenCfg {
watchPaths: string[]
}
export async function watchNexusTypegen (cfg: NexusTypegenWatchCfg) {
const dfd = pDefer()
const watcher = chokidar.watch(cfg.watchPaths, {
cwd: cfg.cwd,
ignored: /\.gen\.ts/,
ignoreInitial: true,
})
watcher.on('all', (evt, path) => {
console.log(prefixTypegen(`${evt} ${path}`))
nexusTypegenDebounced(cfg)
})
watcher.on('ready', () => {
console.log(prefixTypegen(`Codegen Watcher Ready for ${cfg.filePath}`))
nexusTypegen(cfg).then(dfd.resolve, dfd.reject)
})
return dfd.promise
}
export async function nexusCodegen () {
return nexusTypegen({
cwd: dataContextPackageRoot,
-1
View File
@@ -80,7 +80,6 @@
"devDependencies": {
"@babel/types": "7.28.2",
"@jest/globals": "^30.1.2",
"@packages/app": "0.0.0-development",
"@packages/config": "0.0.0-development",
"@packages/errors": "0.0.0-development",
"@packages/example": "0.0.0-development",
@@ -16,7 +16,7 @@ import type { RunSpecErrorCode } from '../../graphql/schemaTypes'
import debugLib from 'debug'
import { logError } from '@packages/stderr-filtering'
export class RunSpecError extends Error {
class RunSpecError extends Error {
constructor (public code: typeof RunSpecErrorCode[number], msg: string) {
super(msg)
}
@@ -35,7 +35,7 @@ const RELEVANT_RUN_OPERATION_DOC = gql`
}
`
export const RUNS_EMPTY_RETURN: RelevantRun = { commitsAhead: -1, all: [], latest: [] }
const RUNS_EMPTY_RETURN: RelevantRun = { commitsAhead: -1, all: [], latest: [] }
/**
* DataSource to encapsulate querying Cypress Cloud for runs that match a list of local Git commit shas
@@ -95,7 +95,7 @@ export async function insertValueInJSString (fileContents: string, obj: Record<s
return resultCode + fileContents.slice(nextStartingIndex)
}
export function isDefineConfigFunction (ast: File, functionName: string): boolean {
function isDefineConfigFunction (ast: File, functionName: string): boolean {
let value = false
visit(ast, {
-9
View File
@@ -1,18 +1,9 @@
import { defaultSpecPattern } from '@packages/config'
import type { TestingType, FoundSpec } from '@packages/types'
import Debug from 'debug'
import _ from 'lodash'
import path from 'path'
import { getPathFromSpecPattern, getLongestCommonPrefixFromPaths } from '../sources/ProjectDataSource'
export const isDefaultSupportFile = (supportFile: string) => {
if (_.isNil(supportFile) || !_.isBoolean(supportFile) && supportFile.match(/(^|\.+\/)cypress\/support($|\/index($|\.(ts|js|coffee)$))/)) {
return true
}
return false
}
export type FileExtension = 'js' | 'ts' | 'jsx' | 'tsx'
export async function getDefaultSpecFileName (
@@ -29,10 +29,22 @@ import type {
CloudProjectRunsByCommitShasArgs,
} from '../../src/gen/test-cloud-graphql-types.gen'
import type { GraphQLResolveInfo } from 'graphql'
import type { DebugTestingProgress_SpecsSubscription } from '@packages/app/src/generated/graphql'
type ConfigFor<T> = Omit<T, 'id' | '__typename'>
// Local type definition matching DebugTestingProgress_SpecsSubscription
// to avoid circular dependency with @packages/app
type DebugTestingProgress_SpecsSubscription = {
__typename: 'Subscription'
relevantRunSpecChange: {
__typename: 'CloudRun'
id: string
totalSpecs: number
completedSpecs: number
scheduledToCompleteAt: string | null
}
}
export type CloudTypesWithId = {
[K in keyof CodegenTypeMap]: 'id' extends keyof CodegenTypeMap[K] ? K : never
}[keyof CodegenTypeMap]
@@ -13,7 +13,7 @@
/** eslint-disable */
import $ from 'jquery'
export function $scrollTo (target, duration, settings) {
function $scrollTo (target, duration, settings) {
return $(window).scrollTo(target, duration, settings)
}
+2 -2
View File
@@ -5,7 +5,7 @@ import Promise from 'bluebird'
import debugFn from 'debug'
import $dom from '../dom'
import $utils from './../cypress/utils'
import type { ElWindowPostion, ElViewportPostion, ElementPositioning } from '../dom/coordinates'
import type { ElWindowPosition, ElViewportPosition, ElementPositioning } from '../dom/coordinates'
import $elements from '../dom/elements'
import $errUtils from '../cypress/error_utils'
import { callNativeMethod, getNativeProp } from '../dom/elements/nativeProps'
@@ -505,7 +505,7 @@ const verify = function (cy, $el, config, options, callbacks: VerifyCallbacks) {
}
return Promise.try(() => {
const coordsHistory: (ElViewportPostion | ElWindowPostion)[] = []
const coordsHistory: (ElViewportPosition | ElWindowPosition)[] = []
const runAllChecks = function () {
let $elAtCoords
@@ -5,7 +5,7 @@ import $dom from '../../../dom'
import $utils from '../../../cypress/utils'
import $errUtils from '../../../cypress/error_utils'
import $actionability from '../../actionability'
import type { ElViewportPostion } from '../../../dom/coordinates'
import type { ElViewportPosition } from '../../../dom/coordinates'
import type { $Cy } from '../../../cypress/cy'
import type { ForceEl } from '../../mouse'
@@ -43,7 +43,7 @@ type MouseActionOptions = {
positionOrX: string | number
y: number
userOptions: Record<string, any>
onReady: (fromElViewport: ElViewportPostion, forceEl: ForceEl) => any
onReady: (fromElViewport: ElViewportPosition, forceEl: ForceEl) => any
onTable: Function
defaultOptions?: Record<string, any>
}
@@ -347,7 +347,6 @@ export default (Commands, Cypress, cy: $Cy, state, config) => {
),
}
},
}
},
})
@@ -33,7 +33,7 @@ type TakeScreenshotOptions = {
timeout?: number
}
type AutomationOptions = TakeScreenshotOptions & Omit<Cypress.ScreenshotOptions, 'onBeforeScreenshot'| 'onAfterScreenshot' | 'disableTimersAndAnimations' | 'scale' | 'padding'> & Partial<Cypress.ScreenshotOptions>
type ScreenshotAutomationOptions = TakeScreenshotOptions & Omit<Cypress.ScreenshotOptions, 'onBeforeScreenshot'| 'onAfterScreenshot' | 'disableTimersAndAnimations' | 'scale' | 'padding'> & Partial<Cypress.ScreenshotOptions>
const getViewportHeight = (state: StateFunc) => {
// TODO this doesn't seem correct
@@ -149,7 +149,7 @@ const scrollOverrides = (win: Window, doc: Document) => {
}
}
const validateNumScreenshots = (numScreenshots: number, automationOptions: AutomationOptions) => {
const validateNumScreenshots = (numScreenshots: number, automationOptions: ScreenshotAutomationOptions) => {
if (numScreenshots < 1) {
$errUtils.throwErrByPath('screenshot.invalid_height', {
log: automationOptions.log,
@@ -157,7 +157,7 @@ const validateNumScreenshots = (numScreenshots: number, automationOptions: Autom
}
}
const takeScrollingScreenshots = (scrolls: Scroll[], win: Window, state: StateFunc, automationOptions: AutomationOptions) => {
const takeScrollingScreenshots = (scrolls: Scroll[], win: Window, state: StateFunc, automationOptions: ScreenshotAutomationOptions) => {
const scrollAndTake = ({ y, clip, afterScroll }: Scroll, index) => {
win.scrollTo(0, y)
if (afterScroll) {
@@ -178,7 +178,7 @@ const takeScrollingScreenshots = (scrolls: Scroll[], win: Window, state: StateFu
.then(_.last)
}
const takeFullPageScreenshot = (state: StateFunc, automationOptions: AutomationOptions) => {
const takeFullPageScreenshot = (state: StateFunc, automationOptions: ScreenshotAutomationOptions) => {
const win = state('window')
const doc = state('document')
@@ -218,7 +218,7 @@ const takeFullPageScreenshot = (state: StateFunc, automationOptions: AutomationO
.finally(resetScrollOverrides)
}
const applyPaddingToElementPositioning = (elPosition: Cypress.ElementPositioning, automationOptions: AutomationOptions) => {
const applyPaddingToElementPositioning = (elPosition: Cypress.ElementPositioning, automationOptions: ScreenshotAutomationOptions) => {
if (!automationOptions.padding) {
return elPosition
}
@@ -240,7 +240,7 @@ const applyPaddingToElementPositioning = (elPosition: Cypress.ElementPositioning
}
}
const takeElementScreenshot = ($el: JQuery<HTMLElement>, state: StateFunc, automationOptions: AutomationOptions) => {
const takeElementScreenshot = ($el: JQuery<HTMLElement>, state: StateFunc, automationOptions: ScreenshotAutomationOptions) => {
const win = state('window')
const doc = state('document')
@@ -429,7 +429,7 @@ const takeScreenshot = (
})
}
const automationOptions: AutomationOptions = _.extend({}, options, {
const automationOptions: ScreenshotAutomationOptions = _.extend({}, options, {
capture,
clip: {
x: 0,
+4 -4
View File
@@ -8,7 +8,7 @@ import debugFn from 'debug'
import type { StateFunc } from '../cypress/state'
import type { IFocused } from './focused'
import type { ICypress } from '../cypress'
import type { ElViewportPostion } from '../dom/coordinates'
import type { ElViewportPosition } from '../dom/coordinates'
const debug = debugFn('cypress:driver:mouse')
@@ -213,7 +213,7 @@ export const create = (state: StateFunc, keyboard: Keyboard, focused: IFocused,
}, modifiersEventOptions, coordsEventOptions)
},
move (fromElViewport: ElViewportPostion, forceEl?: ForceEl) {
move (fromElViewport: ElViewportPosition, forceEl?: ForceEl) {
debug('mouse.move', fromElViewport)
const lastHoveredEl = getLastHoveredEl(state)
@@ -245,7 +245,7 @@ export const create = (state: StateFunc, keyboard: Keyboard, focused: IFocused,
* - send move events to elToHover (bubbles)
* - elLastHovered = elToHover
*/
_moveEvents (el: HTMLElement, coords: ElViewportPostion) {
_moveEvents (el: HTMLElement, coords: ElViewportPosition) {
// events are not fired on disabled elements, so we don't have to take that into account
const win = $dom.getWindowByElement(el)
const { x, y } = coords
@@ -390,7 +390,7 @@ export const create = (state: StateFunc, keyboard: Keyboard, focused: IFocused,
* @param {Coords} coords
* @returns {HTMLElement}
*/
getElAtCoords ({ x, y, doc }: ElViewportPostion) {
getElAtCoords ({ x, y, doc }: ElViewportPosition) {
const el = $dom.elementFromPoint(doc, x, y)
return el
@@ -34,7 +34,7 @@ import isValidHostname from 'is-valid-hostname'
const lowercaseFieldNames = (headers: { [fieldName: string]: any }) => _.mapKeys(headers, (v, k) => _.toLower(k))
export function hasOnlyRouteMatcherKeys (obj: any) {
function hasOnlyRouteMatcherKeys (obj: any) {
return !_.isEmpty(obj) && !_.isArray(obj) && _.isEmpty(_.omit(obj, _.concat(PLAIN_FIELDS, STRING_MATCHER_FIELDS, DICT_STRING_MATCHER_FIELDS)))
}
@@ -1,7 +1,7 @@
import { find } from 'lodash'
import type { CyHttpMessages } from '@packages/net-stubbing/lib/types'
export function hasJsonContentType (headers: { [k: string]: string | string[] }) {
function hasJsonContentType (headers: { [k: string]: string | string[] }) {
const contentType = find(headers, (v, k) => /^content-type$/i.test(k))
if (Array.isArray(contentType)) {
@@ -1,3 +1 @@
export { addCommand } from './add-command'
export { waitForRoute } from './wait-for-route'
@@ -14,7 +14,7 @@ import $errUtils from '../../cypress/error_utils'
// user-facing StaticResponse only
export const STATIC_RESPONSE_KEYS: (keyof StaticResponse)[] = ['body', 'fixture', 'statusCode', 'headers', 'forceNetworkError', 'throttleKbps', 'delay']
export const STATIC_RESPONSE_WITH_OPTIONS_KEYS: (keyof StaticResponseWithOptions)[] = [...STATIC_RESPONSE_KEYS, 'log']
const STATIC_RESPONSE_WITH_OPTIONS_KEYS: (keyof StaticResponseWithOptions)[] = [...STATIC_RESPONSE_KEYS, 'log']
export function validateStaticResponse (cmd: string, staticResponse: StaticResponse): void {
const err = (message) => {
@@ -129,7 +129,7 @@ export function getBackendStaticResponse (staticResponse: Readonly<StaticRespons
return backendStaticResponse
}
export function hasStaticResponseKeys (obj: any) {
function hasStaticResponseKeys (obj: any) {
return !_.isArray(obj) && (_.intersection(_.keys(obj), STATIC_RESPONSE_KEYS).length || _.isEmpty(obj))
}
+1 -1
View File
@@ -15,7 +15,7 @@ interface Callbacks {
onError: (err, method, obj, negated) => void
}
export const $chaiJquery = (chai: Chai.ChaiStatic, chaiUtils: Chai.ChaiUtils, callbacks: Callbacks) => {
const $chaiJquery = (chai: Chai.ChaiStatic, chaiUtils: Chai.ChaiUtils, callbacks: Callbacks) => {
const { inspect, flag } = chaiUtils
const assertPartial = (
-4
View File
@@ -1,4 +0,0 @@
type SetterGetter<S> = {
<K extends keyof S, T extends S[K]>(key: K): T
<K extends keyof S, T extends S[K]>(key: K, value: T): T
}
+4 -4
View File
@@ -41,7 +41,7 @@ const getFirstValidSizedRect = (el) => {
}) || el.getBoundingClientRect() // otherwise fall back to the parent client rect
}
export type ElViewportPostion = {
export type ElViewportPosition = {
doc: Document
x?: number
y?: number
@@ -53,7 +53,7 @@ export type ElViewportPostion = {
leftCenter: number
}
export type ElWindowPostion = {
export type ElWindowPosition = {
x?: number
y?: number
top: number
@@ -67,8 +67,8 @@ export type ElementPositioning = {
scrollLeft: number
width: number
height: number
fromElViewport: ElViewportPostion
fromElWindow: ElWindowPostion
fromElViewport: ElViewportPosition
fromElWindow: ElWindowPosition
fromAutWindow: {
x?: number
y?: number
+2 -2
View File
@@ -289,12 +289,12 @@ const canClipContent = function ($el: JQuery<HTMLElement>, $ancestor: JQuery<HTM
return true
}
export const isW3CRendered = (el) => {
const isW3CRendered = (el) => {
// @see https://html.spec.whatwg.org/multipage/rendering.html#being-rendered
return !(parentHasDisplayNone(wrap(el)) || wrap(el).css('visibility') === 'hidden')
}
export const isW3CFocusable = (el) => {
const isW3CFocusable = (el) => {
// @see https://html.spec.whatwg.org/multipage/interaction.html#focusable-area
return isFocusable(wrap(el)) && isW3CRendered(el)
}
@@ -3,7 +3,7 @@ import structuredClonePonyfill from 'core-js-pure/actual/structured-clone'
import $stackUtils from '../../cypress/stack_utils'
import $errUtils from '../../cypress/error_utils'
export const UNSERIALIZABLE = '__cypress_unserializable_value'
const UNSERIALIZABLE = '__cypress_unserializable_value'
// If a native structuredClone exists, use that to determine if a value can be serialized or not. Otherwise, use the ponyfill.
// we need this because some implementations of SCA treat certain values as unserializable (ex: Error is serializable in ponyfill but NOT in firefox implementations)
@@ -110,7 +110,7 @@ export const reifyDomElement = (props: any) => {
* @param {boolean} [attemptToSerializeFunctions=false] - Whether or not the function should attempt to preprocess a function by invoking it.
* @returns
*/
export const preprocessObjectLikeForSerialization = (props, attemptToSerializeFunctions = false) => {
const preprocessObjectLikeForSerialization = (props, attemptToSerializeFunctions = false) => {
if (_.isArray(props)) {
return props.map((prop) => preprocessLogLikeForSerialization(prop, attemptToSerializeFunctions))
}
@@ -154,7 +154,7 @@ export const preprocessObjectLikeForSerialization = (props, attemptToSerializeFu
* @param {boolean} matchElementsAgainstSnapshotDOM - whether DOM elements within the Object/Array should be matched against
* @returns {Object|Proxy} - a reified version of the Object or Array (Proxy).
*/
export const reifyObjectLikeForSerialization = (props, matchElementsAgainstSnapshotDOM) => {
const reifyObjectLikeForSerialization = (props, matchElementsAgainstSnapshotDOM) => {
let reifiedObjectOrArray = {}
_.forIn(props, (value, key) => {
@@ -275,7 +275,7 @@ export const preprocessLogLikeForSerialization = (props, attemptToSerializeFunct
* against the currently rendered DOM (usually against a rendered snapshot) or should be completely recreated from scratch (common with snapshots as they will replace the DOM)
* @returns {any} the reified version of the generic.
*/
export const reifyLogLikeFromSerialization = (props, matchElementsAgainstSnapshotDOM = true) => {
const reifyLogLikeFromSerialization = (props, matchElementsAgainstSnapshotDOM = true) => {
try {
if (props?.serializationKey === 'dom') {
props.reifyElement = function () {
+7 -11
View File
@@ -37,7 +37,7 @@ export const icons = () => {
return require('@packages/icons')
}
export function checkCurrentVersion (pathToVersion: string) {
function checkCurrentVersion (pathToVersion: string) {
// read in the version file
return fs.readFile(pathToVersion, 'utf8').then((str) => {
const version = str.replace('v', '')
@@ -52,7 +52,7 @@ export function checkCurrentVersion (pathToVersion: string) {
})
}
export async function getFileHash (filePath: string): Promise<string> {
async function getFileHash (filePath: string): Promise<string> {
const hash = crypto.createHash('sha1')
const stream = createReadStream(filePath)
@@ -61,7 +61,7 @@ export async function getFileHash (filePath: string): Promise<string> {
return hash.digest('hex')
}
export async function checkIconVersion () {
async function checkIconVersion () {
// TODO: this seems wrong, it's hard coding the check only for OSX and not windows or linux (!?)
const mainIconsPath = icons().getPathToIcon('cypress.icns')
const cachedIconsPath = path.join(
@@ -78,11 +78,7 @@ export async function checkIconVersion () {
}
}
export function checkExecExistence (pathToExec: string) {
return fs.stat(pathToExec)
}
export async function checkBinaryArchCpuArch (
async function checkBinaryArchCpuArch (
pathToExec: string,
platform: string,
arch: string,
@@ -114,7 +110,7 @@ export async function packageAndExit () {
process.exit()
}
export async function getRealArch (platform: string, arch: string) {
async function getRealArch (platform: string, arch: string) {
if (platform === 'darwin' && arch === 'x64') {
// see this comment for explanation of x64 -> arm64 translation
// https://github.com/cypress-io/cypress/pull/25014/files#diff-85c4db7620ed2731baf5669a9c9993e61e620693a008199ca7c584e621b6a1fdR11
@@ -141,7 +137,7 @@ interface PkgElectronAppOptions {
icon: string
}
export async function pkgElectronApp (
async function pkgElectronApp (
options: Partial<PkgElectronAppOptions> = {},
) {
/**
@@ -209,7 +205,7 @@ export async function pkgElectronApp (
}
}
export function ensure () {
function ensure () {
const arch = os.arch()
const platform = os.platform()
const pathToExec = getPathToExec()
+9 -9
View File
@@ -28,7 +28,7 @@ export class PartialErr {
constructor (readonly strArr: TemplateStringsArray, readonly args: AllowedTemplateArg[]) {}
}
interface FormatConfig {
export interface FormatConfig {
block?: true
color?: typeof theme[keyof typeof theme]
stringify?: boolean
@@ -36,7 +36,7 @@ interface FormatConfig {
type ToFormat = string | number | Error | object | null | Guard | AllowedTemplateArg
class Format {
export class Format {
constructor (
readonly type: keyof typeof fmtHighlight,
readonly val: ToFormat,
@@ -45,7 +45,7 @@ class Format {
this.color = config.color || fmtHighlight[this.type]
}
private color: typeof theme[keyof typeof theme]
public color: typeof theme[keyof typeof theme]
formatVal (target: 'ansi' | 'markdown'): string {
if (this.val instanceof Guard) {
@@ -58,7 +58,7 @@ class Format {
return isMultiLine(str) ? `\n\n${str}` : str
}
private formatAnsi () {
public formatAnsi () {
const val = this.prepVal('ansi')
if (this.type === 'terminal') {
@@ -68,7 +68,7 @@ class Format {
return this.color(val)
}
private formatMarkdown () {
public formatMarkdown () {
if (this.type === 'comment') {
return `${this.val}`
}
@@ -86,7 +86,7 @@ class Format {
return mdFence(this.prepVal('markdown'))
}
private prepVal (target: 'ansi' | 'markdown'): string {
public prepVal (target: 'ansi' | 'markdown'): string {
if (this.val instanceof PartialErr) {
return prepMessage(this.val.strArr, this.val.args, target, true)
}
@@ -220,7 +220,7 @@ function listFlags (
.value())
}
export class Guard {
class Guard {
constructor (readonly val: string | number) {}
}
@@ -228,7 +228,7 @@ export class Guard {
* Prevents a string from being colored "blue" when wrapped in the errTemplate
* tag template literal
*/
export function guard (val: string | number) {
function guard (val: string | number) {
return new Guard(val)
}
@@ -236,7 +236,7 @@ export function guard (val: string | number) {
* Marks the value as "details". This is when we print out the stack trace to the console
* (if it's an error), or use the stack trace as the originalError
*/
export class StackTrace {
class StackTrace {
/**
* @param {string | Error | object} stackTrace
*/
+1 -1
View File
@@ -32,7 +32,7 @@ const getUsedTestsMessage = (limit: number, usedTestsMessage: string) => {
: fmt.off('')
}
export const warnIfExplicitCiBuildId = function (ciBuildId?: string | null) {
export const warnIfExplicitCiBuildId = function (ciBuildId?: string | null): ReturnType<typeof errPartial> | null {
if (!ciBuildId) {
return null
}
@@ -33,6 +33,4 @@ export async function initHighlighter () {
})
}
const inheritAttrs = false
export { highlighter, inheritAttrs }
export { highlighter }
@@ -14,8 +14,6 @@ export type MessageSchema = typeof enUS
export const defaultMessages: MessageSchema = JSON.parse(rawJsonMessages)
export const VueI18n = createI18n()
export function createI18n (opts = {}) {
return _createI18n<MessageSchema, 'en-US'>({
locale: 'en-US',
@@ -49,7 +49,7 @@ export const CLOUD_STATUSES = [
'allTasksCompleted',
] as const
export const PROJECT_STATUSES = [
const PROJECT_STATUSES = [
'isComponentTestingCandidate',
'allTasksCompleted',
] as const
+5 -2
View File
@@ -1,5 +1,10 @@
{
"extends": "../ts/tsconfig.json",
"include": [
"src/**/*",
"cypress/**/*",
"*.d.ts"
],
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "ESNext"],
@@ -13,8 +18,6 @@
},
"types": [
"chrome",
"./vue-shims",
"./vite-env",
"@intlify/unplugin-vue-i18n/messages",
"@testing-library/cypress",
"cypress-real-events",
+1 -1
View File
@@ -1,6 +1,6 @@
import { parse } from 'url'
export function parseHost (hostString: string, defaultPort: number) {
function parseHost (hostString: string, defaultPort: number) {
let m
m = hostString.match(/^http:\/\/(.*)/)
+2 -2
View File
@@ -8,7 +8,7 @@ import plist from 'plist'
const debugVerbose = Debug('cypress-verbose:launcher:darwin:util')
/** parses Info.plist file from given application and returns a property */
export function parsePlist (p: string, property: string): Promise<string> {
function parsePlist (p: string, property: string): Promise<string> {
const pl = path.join(p, 'Contents', 'Info.plist')
debugVerbose('reading property file "%s"', pl)
@@ -30,7 +30,7 @@ export function parsePlist (p: string, property: string): Promise<string> {
}
/** uses mdfind to find app using Ma app id like 'com.google.Chrome.canary' */
export function mdfind (id: string): Promise<string> {
function mdfind (id: string): Promise<string> {
const cmd = `mdfind 'kMDItemCFBundleIdentifier=="${id}"' | head -1`
debugVerbose('looking for bundle id %s using command: %s', id, cmd)
@@ -66,7 +66,7 @@ import type { BadgeRowStatus } from '@cy/components/Badge.vue'
export type FileRowStatus = 'changes' | 'valid' | 'skipped' | 'error';
export type StatusInfo = {
type StatusInfo = {
badgeLabel?: string
badgeType?: BadgeRowStatus
icon: FunctionalComponent<SVGAttributes, {}>
@@ -1,27 +0,0 @@
import type { DirectiveBinding } from 'vue'
/**
* Runs the binding when clicking outside of the targetted component
*/
export const ClickOutside = {
beforeMount (el: any, binding: DirectiveBinding<any>) {
// Define ourClickEventHandler
const ourClickEventHandler = (event: MouseEvent) => {
if (!el.contains(event.target) && el !== event.target) {
// as we are attaching an click event listern to the document (below)
// ensure the events target is outside the element or a child of it
binding.value(event) // before binding it
}
}
// attached the handler to the element so we can remove it later easily
el.__vueClickEventHandler__ = ourClickEventHandler
// attaching ourClickEventHandler to a listener on the document here
document.addEventListener('click', ourClickEventHandler)
},
unmounted (el: any) {
// Remove Event Listener
document.removeEventListener('click', el.__vueClickEventHandler__)
},
}
+1 -1
View File
@@ -28,7 +28,7 @@ import { computed, ref } from 'vue'
import LaunchpadHeader from './LaunchpadHeader.vue'
import { useI18n } from '@cy/i18n'
export type CurrentStep = 'selectFramework' | 'installDependencies'
type CurrentStep = 'selectFramework' | 'installDependencies'
const props = defineProps<{
gql: WizardFragment
@@ -1,8 +0,0 @@
export function stringToRegexp (s: string): RegExp {
return new RegExp(s)
}
export interface FilePart {
text: string
highlight: boolean
}
+1 -1
View File
@@ -394,7 +394,7 @@ export interface RouteMatcherOptionsGeneric<S> {
url?: S
}
export type RouteHandlerController<TRequest = any, TResponse = any> = HttpRequestInterceptor<TRequest, TResponse>
type RouteHandlerController<TRequest = any, TResponse = any> = HttpRequestInterceptor<TRequest, TResponse>
export type RouteHandler<TRequest = any, TResponse = any> = string | StaticResponseWithOptions | RouteHandlerController<TRequest, TResponse> | object
+1 -22
View File
@@ -128,7 +128,7 @@ export function urlMatchesPolicyProps ({ policy, frameUrl, topProps }: {
}
}
export function urlMatchesPolicy ({ policy, frameUrl, topUrl }: {
function urlMatchesPolicy ({ policy, frameUrl, topUrl }: {
policy: Policy
frameUrl: string
topUrl: string
@@ -173,27 +173,6 @@ export const policyFromConfig = (config: { injectDocumentDomain: boolean }): Pol
'same-origin'
}
/**
* Checks the supplied url and props against the determined policy.
* The policy is same-super-domain-origin unless the domain is in the list of strict same origin domains,
* in which case the policy is 'same-origin'
* @param frameUrl - The url you are testing the policy for.
* @param topProps - The props of the url you are testing the policy in context of.
* @param opts - an options object containing the skipDomainInjectionForDomains config. Default is undefined.
* @returns boolean, true if matching, false if not.
*/
export const urlMatchesPolicyBasedOnDomainProps = (frameUrl: string, topProps: ParsedHostWithProtocolAndHost, opts?: {
injectDocumentDomain: boolean
}): boolean => {
const policy = opts?.injectDocumentDomain ? 'same-super-domain-origin' : 'same-origin'
return urlMatchesPolicyProps({
policy,
frameUrl,
topProps,
})
}
declare module 'url' {
interface UrlWithStringQuery {
format(): string
+1 -1
View File
@@ -43,7 +43,7 @@ export function stripProtocolAndDefaultPorts (urlToCheck: string) {
return host
}
export function removePort (urlObject: any) {
function removePort (urlObject: any) {
const parsed = parseClone(urlObject)
// set host to undefined else url.format(...) will ignore the port property
+1 -1
View File
@@ -35,7 +35,7 @@
"@packages/network-tools": "0.0.0-development",
"@packages/socket": "0.0.0-development",
"@types/concat-stream": "1.6.1",
"@types/node": "22.18.0",
"@types/node": "22.18.7",
"@types/proxy-from-env": "1.0.4",
"cross-fetch": "^4.1.0",
"express": "4.21.0",
@@ -28,7 +28,7 @@ import { injectIntoServiceWorker } from './util/service-worker-injector'
import { validateHeaderName, validateHeaderValue } from 'http'
import error from '@packages/errors'
export interface ResponseMiddlewareProps {
interface ResponseMiddlewareProps {
/**
* Before using `res.incomingResStream`, `prepareResStream` can be used
* to remove any encoding that prevents it from being returned as plain text.
@@ -41,7 +41,7 @@ type AddInitiatorToServiceWorkerOptions = {
export const serviceWorkerClientEventHandlerName = '__cypressServiceWorkerClientEvent'
export declare type ServiceWorkerEventsPayload = {
declare type ServiceWorkerEventsPayload = {
'fetchRequest': { url: string, isControlled: boolean }
'hasFetchHandler': { hasFetchHandler: boolean }
'clientsClaimed': { clientUrls: string[] }
-1
View File
@@ -1 +0,0 @@
export * from './src/runnables/runnables-store'
+4 -6
View File
@@ -7,11 +7,11 @@ import Collapsible from '../collapsible/collapsible'
import type AgentModel from './agent-model'
import type { Alias } from '../instruments/instrument-model'
export interface AgentProps {
interface AgentComponentProps {
model: AgentModel
}
const Agent = observer(({ model }: AgentProps) => (
const Agent = observer(({ model }: AgentComponentProps) => (
<tr className={cs('agent-item', { 'no-calls': !model.callCount })}>
<td>{model.name}</td>
<td>{model.functionName}</td>
@@ -20,11 +20,11 @@ const Agent = observer(({ model }: AgentProps) => (
</tr>
))
export interface AgentsModel {
interface AgentsModel {
agents: Array<AgentModel>
}
export interface AgentsProps {
interface AgentsProps {
model: AgentsModel
}
@@ -71,6 +71,4 @@ const Agents: React.FC<AgentsProps> = observer(({ model }: AgentsProps) => {
Agents.displayName = 'Agents'
export { Agent, AgentsList }
export default Agents
@@ -111,6 +111,4 @@ const Attempts: React.FC<AttemptsProps> = observer(({ test, isSingleStudioTest,
Attempts.displayName = 'Attempts'
export { Attempt, AttemptHeader, NoCommands }
export default Attempts
@@ -601,6 +601,4 @@ const Command: React.FC<CommandProps> = observer(({ model, aliasesWithDuplicates
Command.displayName = 'Command'
export { Aliases, AliasesReferences, Message, Progress }
export default Command
+1 -1
View File
@@ -15,7 +15,7 @@ export interface ParsedStackFileLine extends FileDetails {
whitespace: string
}
export type ParsedStackLine = ParsedStackMessageLine | ParsedStackFileLine
type ParsedStackLine = ParsedStackMessageLine | ParsedStackFileLine
export interface CodeFrame extends FileDetails {
frame: string
+6 -6
View File
@@ -9,7 +9,7 @@ import type HookModel from './hook-model'
import type { HookName } from './hook-model'
import { OpenFileInIDEButton } from '../header/OpenFileInIDEButton'
export interface HookHeaderProps {
interface HookHeaderProps {
model: HookModel
number?: number
}
@@ -21,13 +21,13 @@ const HookHeader = ({ model, number }: HookHeaderProps) => (
</span>
)
export interface HookProps {
interface HookComponentProps {
model: HookModel
showNumber: boolean
scrollIntoView: Function
}
const Hook: React.FC<HookProps> = observer(({ model, showNumber, scrollIntoView }: HookProps) => (
const Hook: React.FC<HookComponentProps> = observer(({ model, showNumber, scrollIntoView }: HookComponentProps) => (
<li className={cs('hook-item', { 'hook-failed': model.failed })}>
<Collapsible
header={
@@ -52,13 +52,13 @@ const Hook: React.FC<HookProps> = observer(({ model, showNumber, scrollIntoView
Hook.displayName = 'Hook'
export interface HooksModel {
interface HooksModel {
hooks: HookModel[]
hookCount: { [name in HookName]: number }
state: string
}
export interface HooksProps {
interface HooksProps {
state?: AppState
model: HooksModel
scrollIntoView: Function
@@ -78,6 +78,6 @@ const Hooks: React.FC<HooksProps> = observer(({ state = appState, model, scrollI
Hooks.displayName = 'Hooks'
export { Hook, HookHeader }
export { Hook }
export default Hooks
@@ -9,7 +9,7 @@ export interface AliasObject {
export type Alias = string | Array<string> | null | AliasObject | Array<AliasObject>
export type DefaultCollapsedState = 'closed' | 'open'
type DefaultCollapsedState = 'closed' | 'open'
export interface InstrumentProps {
id: number
+4 -6
View File
@@ -9,7 +9,7 @@ import Collapsible from '../collapsible/collapsible'
import Tag from '../lib/tag'
import type RouteModel from './route-model'
export interface RouteProps {
interface RouteProps {
model: RouteModel
}
@@ -30,11 +30,11 @@ const Route = observer(({ model }: RouteProps) => (
</tr>
))
export interface RouteListModel {
interface RouteListModel {
routes: Array<RouteModel>
}
export interface RouteListProps {
interface RouteListProps {
model: RouteListModel
}
@@ -46,7 +46,7 @@ const RoutesList: React.FC<RouteListProps> = observer(({ model }: RouteListProps
RoutesList.displayName = 'RoutesList'
export interface RoutesProps {
interface RoutesProps {
model: RouteListModel
}
@@ -95,6 +95,4 @@ const Routes: React.FC<RoutesProps> = observer(({ model }: RoutesProps) => {
Routes.displayName = 'Routes'
export { Route, RoutesList }
export default Routes
@@ -156,6 +156,4 @@ const Runnable: React.FC<RunnableProps> = observer(({ model, studioEnabled, canS
Runnable.displayName = 'Runnable'
export { Suite }
export default Runnable
@@ -1,14 +1,11 @@
import type { TestFilter } from '@packages/types'
import _ from 'lodash'
import { action, observable, makeObservable } from 'mobx'
import type AgentModel from '../agents/agent-model'
import type { AgentProps } from '../agents/agent-model'
import type CommandModel from '../commands/command-model'
import type { CommandProps } from '../commands/command-model'
import type { HookProps } from '../hooks/hook-model'
import appState, { AppState } from '../lib/app-state'
import scroller, { Scroller } from '../lib/scroller'
import type RouteModel from '../routes/route-model'
import type { RouteProps } from '../routes/route-model'
import TestModel, { TestProps, UpdatableTestProps, UpdateTestCallback } from '../test/test-model'
import type RunnableModel from './runnable-model'
@@ -18,7 +15,6 @@ const defaults = {
hasSingleTest: false,
hasTests: false,
isReady: false,
attemptingShowSnapshot: false,
showingSnapshot: false,
}
@@ -32,8 +28,6 @@ export type LogProps = AgentProps | CommandProps | RouteProps
export type RunnableArray = Array<TestModel | SuiteModel>
export type Log = AgentModel | CommandModel | RouteModel
export interface RootRunnable {
hooks?: Array<HookProps>
tests?: Array<TestProps>
@@ -112,7 +112,7 @@ const RunnablesList: React.FC<RunnablesListProps> = observer(({ runnables, studi
RunnablesList.displayName = 'RunnablesList'
export interface RunnablesContentProps {
interface RunnablesContentProps {
runnablesStore: RunnablesStore
spec: Cypress.Cypress['spec']
error?: RunnablesErrorModel
@@ -159,7 +159,7 @@ const RunnablesContent: React.FC<RunnablesContentProps> = observer(({ runnablesS
RunnablesContent.displayName = 'RunnablesContent'
export interface RunnablesProps {
interface RunnablesProps {
error?: RunnablesErrorModel
runnablesStore: RunnablesStore
statsStore: StatsStore
@@ -208,7 +208,4 @@ const Runnables: React.FC<RunnablesProps> = observer(({ appState, scroller, erro
})
Runnables.displayName = 'Runnables'
export { RunnablesList }
export default Runnables
@@ -6,7 +6,7 @@ import url from 'url'
const debug = Debug('cypress:rewriter:deferred-source-map-cache')
export type DeferredSourceMapRequest = {
type DeferredSourceMapRequest = {
uniqueId: string
url: string
js?: string
+1 -1
View File
@@ -121,7 +121,7 @@ export function createInitialWorkers () {
// try to cleanly shut down worker threads to avoid SIGABRT in Electron
// @see https://github.com/electron/electron/issues/23366
export function shutdownWorker (workerInfo: WorkerInfo) {
function shutdownWorker (workerInfo: WorkerInfo) {
const { thread } = workerInfo
return new Bluebird((resolve) => {
-1
View File
@@ -10,7 +10,6 @@
"types": [
"node",
"cypress",
"cypress-real-events",
"react",
], /* Type declaration files to be included in compilation. */
"noErrorTruncation": true
+2 -2
View File
@@ -11,9 +11,9 @@ import { AutomationNotImplemented } from './automation_not_implemented'
const debug = Debug('cypress:server:automation')
export type OnBrowserPreRequest = (browserPreRequest: BrowserPreRequest) => Promise<void>
type OnBrowserPreRequest = (browserPreRequest: BrowserPreRequest) => Promise<void>
export type AutomationOptions = {
type AutomationOptions = {
cyNamespace?: string
cookieNamespace?: string
screenshotsFolder?: string | false
+2 -2
View File
@@ -73,7 +73,7 @@ const normalizeCookieProps = function (automationCookie: SerializableAutomationC
return cookie as AutomationCookie
}
export const normalizeGetCookies = (cookies: (AutomationCookie | null)[]): (AutomationCookie | null)[] => {
const normalizeGetCookies = (cookies: (AutomationCookie | null)[]): (AutomationCookie | null)[] => {
return _.chain(cookies)
.map(normalizeGetCookieProps)
// sort in order of expiration date, ascending
@@ -81,7 +81,7 @@ export const normalizeGetCookies = (cookies: (AutomationCookie | null)[]): (Auto
.value()
}
export const normalizeGetCookieProps = (props: AutomationCookie | null) => {
const normalizeGetCookieProps = (props: AutomationCookie | null) => {
if (!props) {
return props
}
@@ -12,7 +12,7 @@ import { installErrorTransform } from './axios_middleware/transform_error'
import { installLogging } from './axios_middleware/logging'
import { installEncryption } from './axios_middleware/encryption'
export interface CreateCloudRequestOptions {
interface CreateCloudRequestOptions {
/**
* The baseURL for all requests for this Cloud Request instance
*/
+1 -1
View File
@@ -258,7 +258,7 @@ function noProxyPreflightTimeout (): number {
}
}
export type CreateRunOptions = {
type CreateRunOptions = {
projectRoot: string
ci: {
params: string
@@ -7,7 +7,7 @@ import { putFetch, ParseKinds } from '../network/fetch'
import { isRetryableError } from '../network/is_retryable_error'
const debug = Debug('cypress:server:cloud:api:protocol-artifact')
export const _delay = linearDelay(500)
const _delay = linearDelay(500)
export const putProtocolArtifact = asyncRetry(
async (artifactPath: string, maxFileSize: number, destinationUrl: string, uploadMonitorSamplingRate: number) => {
+1 -1
View File
@@ -32,7 +32,7 @@ function getPublicKey () {
return keyObjects[env]
}
export interface EncryptRequestData {
interface EncryptRequestData {
jwe: GeneralJWE
secretKey: crypto.KeyObject
}
@@ -1,6 +1,6 @@
import { scrubUrl } from '../api/scrub_url'
export const HttpErrorKind = 'HttpError'
const HttpErrorKind = 'HttpError'
export class HttpError extends Error {
public readonly kind = HttpErrorKind
@@ -1,5 +1,5 @@
export const NON_RETRIABLE_CERT_ERROR_CODES = Object.freeze({
// The leaf certificate signature cant be verified
const NON_RETRIABLE_CERT_ERROR_CODES = Object.freeze({
// The leaf certificate signature can't be verified
UNABLE_TO_VERIFY_LEAF_SIGNATURE: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
// The certificate is a self-signed certificate and not in trusted root store
DEPTH_ZERO_SELF_SIGNED_CERT: 'DEPTH_ZERO_SELF_SIGNED_CERT',
@@ -1,16 +0,0 @@
export const NON_RETRIABLE_CERT_ERROR_CODES = Object.freeze({
// The leaf certificate signature cant be verified
UNABLE_TO_VERIFY_LEAF_SIGNATURE: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
// The certificate is a self-signed certificate and not in trusted root store
DEPTH_ZERO_SELF_SIGNED_CERT: 'DEPTH_ZERO_SELF_SIGNED_CERT',
// A self-signed certificate exists somewhere in the chain
SELF_SIGNED_CERT_IN_CHAIN: 'SELF_SIGNED_CERT_IN_CHAIN',
// The issuer certificate is not available locally
UNABLE_TO_GET_ISSUER_CERT_LOCALLY: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
})
type NonRetriableCertErrorCode = typeof NON_RETRIABLE_CERT_ERROR_CODES[keyof typeof NON_RETRIABLE_CERT_ERROR_CODES]
export const isNonRetriableCertErrorCode = (errorCode: string | number): errorCode is NonRetriableCertErrorCode => {
return Object.values(NON_RETRIABLE_CERT_ERROR_CODES).includes(errorCode as NonRetriableCertErrorCode)
}
@@ -1,4 +1,4 @@
export const StreamStalledErrorKind = 'StreamStalled'
const StreamStalledErrorKind = 'StreamStalled'
export class StreamStalledError extends Error {
public readonly kind = StreamStalledErrorKind
+3 -20
View File
@@ -85,12 +85,10 @@ const _names: StringValues = {
}
/**
* Export this object for easy stubbing from end-to-end tests.
* If you cannot easily pass "names" and "summaries" arguments
* to "getExperimentsFromResolved" function, then use this
* object to change "experiments.names" and "experimental.summaries" objects.
* Internal object containing experiment names and summaries.
* Used as default parameters in getExperimentsFromResolved and getExperiments.
*/
export const experimental = {
const experimental = {
names: _names,
summaries: _summaries,
}
@@ -140,18 +138,3 @@ export const getExperiments = (project: CypressProject, names = experimental.nam
return getExperimentsFromResolved(resolvedEnv, names, summaries)
}
/**
* Allow known experiments here to avoid accidentally showing
* any config key that starts with "experimental" prefix
*/
// @ts-ignore
export const isKnownExperiment = (experiment, key) => {
return Object.keys(experimental.names).includes(key)
}
// exporting a single default object with methods
// helps make it is to stub and to test
export default {
getExperiments,
}
+8 -8
View File
@@ -81,7 +81,7 @@ export async function get (fixturesFolder: string, filePath: string, options: {
}
}
export async function fileExists (p: string) {
async function fileExists (p: string) {
const stat = await fs.statAsync(p)
// check for files, not directories
@@ -95,7 +95,7 @@ export async function fileExists (p: string) {
}
}
export async function parseFile (p: string, fixture: string, options: { encoding?: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null } = {}) {
async function parseFile (p: string, fixture: string, options: { encoding?: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null } = {}) {
if (queue[p]) {
await new Promise<void>((resolve) => setTimeout(resolve, 1))
@@ -123,7 +123,7 @@ export async function parseFile (p: string, fixture: string, options: { encoding
}
}
export async function parseFileByExtension (p: string, fixture: string, ext: string, options: { encoding?: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null } = {}) {
async function parseFileByExtension (p: string, fixture: string, ext: string, options: { encoding?: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null } = {}) {
// If an encoding is specified, return the raw file content instead of
// parsing.
if (typeof options.encoding !== 'undefined') {
@@ -142,7 +142,7 @@ export async function parseFileByExtension (p: string, fixture: string, ext: str
}
}
export async function parseJson (p: string, fixture: string) {
async function parseJson (p: string, fixture: string) {
try {
const content = await fs.readFileAsync(p, 'utf8')
@@ -152,7 +152,7 @@ export async function parseJson (p: string, fixture: string) {
}
}
export async function parseJs (p: string, fixture: string) {
async function parseJs (p: string, fixture: string) {
try {
const str = await fs.readFileAsync(p, 'utf8')
@@ -176,7 +176,7 @@ export async function parseJs (p: string, fixture: string) {
}
}
export async function parseCoffee (p: string, fixture: string) {
async function parseCoffee (p: string, fixture: string) {
const dc = process.env.NODE_DISABLE_COLORS
process.env.NODE_DISABLE_COLORS = '0'
@@ -194,7 +194,7 @@ export async function parseCoffee (p: string, fixture: string) {
}
}
export async function parseHtml (p: string, fixture: string) {
async function parseHtml (p: string, fixture: string) {
try {
const content = await fs.readFileAsync(p, 'utf8')
@@ -204,7 +204,7 @@ export async function parseHtml (p: string, fixture: string) {
}
}
export async function parse (p: string, fixture: string, encoding: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null | undefined) {
async function parse (p: string, fixture: string, encoding: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null | undefined) {
try {
const content = await fs.readFileAsync(p, encoding)
+1 -15
View File
@@ -73,20 +73,6 @@ export function reset () {
windows = {}
}
export function destroy (type: string) {
let win
if (type && (win = getByType(type))) {
return win.destroy()
}
}
export function get (type: string) {
return getByType(type) || (() => {
throw new Error(`No window exists for: '${type}'`)
})()
}
export function showAll () {
return _.invoke(windows, 'showInactive')
}
@@ -114,7 +100,7 @@ export function getByWebContents (webContents) {
return BrowserWindow.fromWebContents(webContents)
}
export function _newBrowserWindow (options) {
function _newBrowserWindow (options) {
return new BrowserWindow(options)
}
-5
View File
@@ -22,8 +22,3 @@ export const has = (event) => {
export const execute = (event, ...args) => {
return getCtx().lifecycleManager.executeNodeEvent(event, args)
}
// for testing purposes
export const _reset = () => {
return getCtx().lifecycleManager.reinitializeCypress()
}
@@ -8,12 +8,6 @@ import * as files from '../files'
import { fs } from '../util/fs'
import task from '../task'
export interface SpecChannelOptions {
isSpecBridge: boolean
url: string
key: string
}
interface SpecOriginatedCommand {
name: string
args: string[]
+3 -8
View File
@@ -35,6 +35,7 @@ import { RemoteStates, RemoteState } from './remote_states'
import { cookieJar, SerializableAutomationCookie } from './util/cookies'
import { resourceTypeAndCredentialManager, ResourceTypeAndCredentialManager } from './util/resourceTypeAndCredentialManager'
import * as fileServer from './file_server'
import type { FileServer } from './file_server'
import appData from './util/app_data'
import { graphqlWS } from '@packages/data-context/graphql/makeGraphQLServer'
import * as statusCode from './util/status_code'
@@ -133,15 +134,9 @@ const notSSE = (req, res) => {
return (req.headers.accept !== 'text/event-stream') && compression.filter(req, res)
}
export type WarningErr = Record<string, any>
type WarningErr = Record<string, any>
type FileServer = {
token: string
port: () => number
close: () => void
}
export interface OpenServerOptions {
interface OpenServerOptions {
SocketCtor: typeof SocketE2E | typeof SocketCt
testingType: Cypress.TestingType
onError: any

Some files were not shown because too many files have changed in this diff Show More