Skip to content

Commit c190faf

Browse files
committed
Merge branch '10.0-release' into lmiller1990/UNIFY-1402
* 10.0-release: (25 commits) fix: stop running spec when switching specs (#21038) fix: remove asset size warnings and enable nuxt e2e tests (#21074) feat: swap the #__cy_root id selector to become data-cy-root for component mounting (#20951) fix: Doc changes around vue2 (#21066) feat: Add vue2 package from npm/vue/v2 branch (#21026) skip failing test fix: add possible frameworks to object API config (#21056) fix snapshot spacing fix system test fix snapshot update snapshots rename spec files rename files update snapshots release 9.5.4 [skip ci] fix(regression): cy.pause() should not be ignored with `cypress run --headed --no-exit` (#20877) fix: add missing Cypress.Commands.addAll() types (#20894) chore: Don't store video and screenshot artifacts for runs (#20979) chore: Update Chrome (beta) to 101.0.4951.26 (#20957) chore: remove parallelism from test-binary-against-repo jobs (#21004) ...
2 parents 10c7f92 + aa98f2e commit c190faf

File tree

212 files changed

+4475
-107122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+4475
-107122
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ cli/types
4141
# cli/react, cli/vue, and cli/mount-utils are all copied from dist'd builds
4242
cli/react
4343
cli/vue
44+
cli/vue2
4445
cli/mount-utils
4546

4647
# packages/example is not linted (think about changing this)
@@ -69,6 +70,9 @@ npm/cypress-schematic/src/**/*.js
6970
/npm/create-cypress-tests/initial-template
7071
/npm/create-cypress-tests/**/*.template.*
7172

73+
# The global eslint configuration is not set up to parse vue@2 files
74+
/npm/vue2/**/*.vue
75+
7276
packages/data-context/test/unit/codegen/files
7377

7478
# community templates we test against, no need to lint

.releaserc.base.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ module.exports = {
1515
],
1616
extends: 'semantic-release-monorepo',
1717
branches: [
18+
'master',
1819
],
1920
}

browser-versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"chrome:beta": "101.0.4951.15",
2+
"chrome:beta": "101.0.4951.26",
33
"chrome:stable": "100.0.4896.75"
44
}

circle.yml

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,6 @@ commands:
695695
name: Run tests using command
696696
working_directory: /tmp/<<parameters.repo>>/<<parameters.folder>>
697697
command: <<parameters.command>>
698-
699-
- store_artifacts:
700-
name: screenshots
701-
path: /tmp/<<parameters.repo>>/<<parameters.folder>>/cypress/screenshots
702-
- store_artifacts:
703-
name: videos
704-
path: /tmp/<<parameters.repo>>/<<parameters.folder>>/cypress/videos
705698
- unless:
706699
condition: <<parameters.folder>>
707700
steps:
@@ -719,12 +712,6 @@ commands:
719712
name: Run tests using command
720713
working_directory: /tmp/<<parameters.repo>>
721714
command: <<parameters.command>>
722-
- store_artifacts:
723-
name: screenshots
724-
path: /tmp/<<parameters.repo>>/cypress/screenshots
725-
- store_artifacts:
726-
name: videos
727-
path: /tmp/<<parameters.repo>>/cypress/videos
728715
- store-npm-logs
729716

730717
test-binary-against-repo:
@@ -844,13 +831,6 @@ commands:
844831
name: Run tests using command
845832
working_directory: /tmp/<<parameters.repo>>/<<parameters.folder>>
846833
command: <<parameters.command>>
847-
848-
- store_artifacts:
849-
name: screenshots
850-
path: /tmp/<<parameters.repo>>/<<parameters.folder>>/cypress/screenshots
851-
- store_artifacts:
852-
name: videos
853-
path: /tmp/<<parameters.repo>>/<<parameters.folder>>/cypress/videos
854834
- unless:
855835
condition: <<parameters.folder>>
856836
steps:
@@ -868,12 +848,6 @@ commands:
868848
name: Run tests using command
869849
working_directory: /tmp/<<parameters.repo>>
870850
command: <<parameters.command>>
871-
- store_artifacts:
872-
name: screenshots
873-
path: /tmp/<<parameters.repo>>/cypress/screenshots
874-
- store_artifacts:
875-
name: videos
876-
path: /tmp/<<parameters.repo>>/cypress/videos
877851
- store-npm-logs
878852

879853
wait-on-circle-jobs:
@@ -956,7 +930,7 @@ commands:
956930
command: ls -la types
957931
working_directory: cli/build
958932
- run:
959-
command: ls -la vue mount-utils react
933+
command: ls -la vue vue2 mount-utils react
960934
working_directory: cli/build
961935
- unless:
962936
condition:
@@ -1565,8 +1539,6 @@ jobs:
15651539
working_directory: npm/vite-dev-server
15661540
- store_test_results:
15671541
path: npm/vite-dev-server/test_results
1568-
- store_artifacts:
1569-
path: npm/vite-dev-server/cypress/videos
15701542
- store-npm-logs
15711543

15721544
npm-webpack-batteries-included-preprocessor:
@@ -1774,10 +1746,6 @@ jobs:
17741746
name: Run Kitchensink example project
17751747
command: |
17761748
yarn cypress:run --project /tmp/cypress-example-kitchensink
1777-
- store_artifacts:
1778-
path: /tmp/cypress-example-kitchensink/cypress/screenshots
1779-
- store_artifacts:
1780-
path: /tmp/cypress-example-kitchensink/cypress/videos
17811749
- store-npm-logs
17821750

17831751
test-kitchensink-against-staging:
@@ -2020,15 +1988,13 @@ jobs:
20201988

20211989
test-binary-against-recipes-chrome:
20221990
<<: *defaults
2023-
parallelism: 3
20241991
steps:
20251992
- test-binary-against-repo:
20261993
repo: cypress-example-recipes
20271994
command: npm run test:ci:chrome
20281995

20291996
test-binary-against-recipes:
20301997
<<: *defaults
2031-
parallelism: 3
20321998
steps:
20331999
- test-binary-against-repo:
20342000
repo: cypress-example-recipes

cli/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ build
1616
# ignore packages synced at build-time via
1717
# the sync-exported-npm-with-cli.js script
1818
vue
19+
vue2
1920
react
20-
mount-utils
21+
mount-utils

cli/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
"types/net-stubbing.ts",
107107
"mount-utils",
108108
"vue",
109-
"react"
109+
"react",
110+
"vue2"
110111
],
111112
"bin": {
112113
"cypress": "bin/cypress"
@@ -124,6 +125,10 @@
124125
"import": "./vue/dist/cypress-vue.esm-bundler.js",
125126
"require": "./vue/dist/cypress-vue.cjs.js"
126127
},
128+
"./vue2": {
129+
"import": "./vue2/dist/cypress-vue2.esm-bundler.js",
130+
"require": "./vue2/dist/cypress-vue2.cjs.js"
131+
},
127132
"./package.json": {
128133
"import": "./package.json",
129134
"require": "./package.json"

cli/scripts/post-build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const npmModulesToCopy = [
1010
'mount-utils',
1111
'react',
1212
'vue',
13+
'vue2',
1314
]
1415

1516
npmModulesToCopy.forEach((folder) => {

cli/scripts/post-install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ shell.set('-e') // any error is fatal
2323
fs.ensureDirSync(join(__dirname, '..', 'types'))
2424

2525
includeTypes.forEach((folder) => {
26-
const source = resolvePkg(`@types/${folder}`, { cwd: join(__dirname, '..', '..') })
26+
const source = resolvePkg(`@types/${folder}`, { cwd: __dirname })
2727

2828
fs.copySync(source, join(__dirname, '..', 'types', folder))
2929
})

cli/types/cypress.d.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ declare namespace Cypress {
2424
interface CommandFn<T extends keyof ChainableMethods> {
2525
(this: Mocha.Context, ...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]> | void
2626
}
27+
interface CommandFns {
28+
[name: string]: (this: Mocha.Context, ...args: any) => any
29+
}
2730
interface CommandFnWithSubject<T extends keyof ChainableMethods, S> {
2831
(this: Mocha.Context, prevSubject: S, ...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]> | void
2932
}
33+
interface CommandFnsWithSubject<S> {
34+
[name: string]: (this: Mocha.Context, prevSubject: S, ...args: any) => any
35+
}
3036
interface CommandOriginalFn<T extends keyof ChainableMethods> extends CallableFunction {
3137
(...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]>
3238
}
@@ -467,6 +473,14 @@ declare namespace Cypress {
467473
add<T extends keyof Chainable, S extends PrevSubject>(
468474
name: T, options: CommandOptions & { prevSubject: S[] }, fn: CommandFnWithSubject<T, PrevSubjectMap<void>[S]>,
469475
): void
476+
addAll<T extends keyof Chainable>(fns: CommandFns): void
477+
addAll<T extends keyof Chainable>(options: CommandOptions & {prevSubject: false}, fns: CommandFns): void
478+
addAll<T extends keyof Chainable, S extends PrevSubject>(
479+
options: CommandOptions & { prevSubject: true | S | ['optional'] }, fns: CommandFnsWithSubject<PrevSubjectMap[S]>,
480+
): void
481+
addAll<T extends keyof Chainable, S extends PrevSubject>(
482+
options: CommandOptions & { prevSubject: S[] }, fns: CommandFnsWithSubject<PrevSubjectMap<void>[S]>,
483+
): void
470484
overwrite<T extends keyof Chainable>(name: T, fn: CommandFnWithOriginalFn<T>): void
471485
overwrite<T extends keyof Chainable, S extends PrevSubject>(name: T, fn: CommandFnWithOriginalFnAndSubject<T, PrevSubjectMap[S]>): void
472486
}
@@ -2987,11 +3001,11 @@ declare namespace Cypress {
29873001

29883002
type DevServerConfigObject = {
29893003
bundler: 'webpack'
2990-
framework: 'react'
3004+
framework: 'react' | 'vue' | 'vue-cli' | 'nuxt' | 'create-react-app'
29913005
webpackConfig?: PickConfigOpt<'webpackConfig'>
29923006
} | {
29933007
bundler: 'vite'
2994-
framework: 'react'
3008+
framework: 'react' | 'vue'
29953009
viteConfig?: Omit<Exclude<PickConfigOpt<'viteConfig'>, undefined>, 'base' | 'root'>
29963010
}
29973011

cli/types/tests/cypress-tests.ts

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,118 @@ namespace CypressCommandsTests {
149149
arg
150150
return cy.wrap(new Promise<number>((resolve) => { resolve(5) }))
151151
})
152+
153+
Cypress.Commands.addAll({
154+
newCommand(arg) {
155+
// $ExpectType any
156+
arg
157+
this // $ExpectType Context
158+
return
159+
},
160+
newCommand2(arg, arg2) {
161+
// $ExpectType any
162+
arg
163+
// $ExpectType any
164+
arg2
165+
},
166+
newCommand3: (arg) => {
167+
// $ExpectType any
168+
arg
169+
return
170+
},
171+
newCommand4: (arg) => {
172+
// $ExpectType any
173+
arg
174+
},
175+
})
176+
Cypress.Commands.addAll({ prevSubject: true }, {
177+
newCommand: (subject, arg) => {
178+
subject // $ExpectType unknown
179+
arg // $ExpectType any
180+
return
181+
},
182+
})
183+
Cypress.Commands.addAll({ prevSubject: false }, {
184+
newCommand: (arg) => {
185+
arg // $ExpectType any
186+
return
187+
},
188+
})
189+
Cypress.Commands.addAll({ prevSubject: 'optional' }, {
190+
newCommand: (subject, arg) => {
191+
subject // $ExpectType unknown
192+
arg // $ExpectType any
193+
return
194+
},
195+
newCommand2: (subject, arg) => {
196+
subject // $ExpectType unknown
197+
arg // $ExpectType any
198+
},
199+
})
200+
Cypress.Commands.addAll({ prevSubject: ['optional'] }, {
201+
newCommand: (subject, arg) => {
202+
subject // $ExpectType unknown
203+
arg // $ExpectType any
204+
},
205+
})
206+
Cypress.Commands.addAll({ prevSubject: 'document' }, {
207+
newCommand: (subject, arg) => {
208+
subject // $ExpectType Document
209+
arg // $ExpectType any
210+
},
211+
})
212+
Cypress.Commands.addAll({ prevSubject: 'window' }, {
213+
newCommand: (subject, arg) => {
214+
subject // $ExpectType Window
215+
arg // $ExpectType any
216+
},
217+
})
218+
Cypress.Commands.addAll({ prevSubject: 'element' }, {
219+
newCommand: (subject, arg) => {
220+
subject // $ExpectType JQuery<HTMLElement>
221+
arg // $ExpectType any
222+
}
223+
})
224+
Cypress.Commands.addAll({ prevSubject: ['element'] }, {
225+
newCommand: (subject, arg) => {
226+
subject // $ExpectType JQuery<HTMLElement>
227+
arg // $ExpectType any
228+
}
229+
})
230+
Cypress.Commands.addAll({ prevSubject: ['element', 'document', 'window'] }, {
231+
newCommand: (subject, arg) => {
232+
if (subject instanceof Window) {
233+
subject // $ExpectType Window
234+
} else if (subject instanceof Document) {
235+
subject // $ExpectType Document
236+
} else {
237+
subject // $ExpectType JQuery<HTMLElement>
238+
}
239+
arg // $ExpectType any
240+
}
241+
})
242+
Cypress.Commands.addAll({ prevSubject: ['window', 'document', 'optional', 'element'] }, {
243+
newCommand: (subject, arg) => {
244+
if (subject instanceof Window) {
245+
subject // $ExpectType Window
246+
} else if (subject instanceof Document) {
247+
subject // $ExpectType Document
248+
} else if (subject) {
249+
subject // $ExpectType JQuery<HTMLElement>
250+
} else {
251+
subject // $ExpectType void
252+
}
253+
arg // $ExpectType any
254+
}
255+
})
256+
Cypress.Commands.addAll({
257+
newCommand: (arg) => {
258+
// $ExpectType any
259+
arg
260+
return cy.wrap(new Promise<number>((resolve) => { resolve(5) }))
261+
}
262+
})
263+
152264
Cypress.Commands.overwrite('newCommand', (originalFn, arg) => {
153265
arg // $ExpectType string
154266
originalFn // $ExpectedType Chainable['newCommand']

0 commit comments

Comments
 (0)