mirror of
https://github.com/cypress-io/cypress.git
synced 2025-12-30 02:59:46 -06:00
fix: testIsolation Typescript types (#24603)
This commit is contained in:
19
cli/types/cypress.d.ts
vendored
19
cli/types/cypress.d.ts
vendored
@@ -395,7 +395,7 @@ declare namespace Cypress {
|
||||
})
|
||||
```
|
||||
*/
|
||||
config(Object: ConfigOptions): void
|
||||
config(Object: TestConfigOverrides): void
|
||||
|
||||
// no real way to type without generics
|
||||
/**
|
||||
@@ -3074,7 +3074,16 @@ declare namespace Cypress {
|
||||
xhrUrl: string
|
||||
}
|
||||
|
||||
interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations' | 'experimentalSessionAndOrigin'>>, Partial<Pick<ResolvedConfigOptions, 'baseUrl'>> {
|
||||
interface SuiteConfigOverrides extends Partial<
|
||||
Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations' | 'experimentalSessionAndOrigin'>
|
||||
>, Partial<Pick<ResolvedConfigOptions, 'baseUrl' | 'testIsolation'>> {
|
||||
browser?: IsBrowserMatcher | IsBrowserMatcher[]
|
||||
keystrokeDelay?: number
|
||||
}
|
||||
|
||||
interface TestConfigOverrides extends Partial<
|
||||
Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations' | 'experimentalSessionAndOrigin'>
|
||||
>, Partial<Pick<ResolvedConfigOptions, 'baseUrl'>> {
|
||||
browser?: IsBrowserMatcher | IsBrowserMatcher[]
|
||||
keystrokeDelay?: number
|
||||
}
|
||||
@@ -6079,7 +6088,7 @@ declare namespace Mocha {
|
||||
* Describe a "suite" with the given `title`, TestOptions, and callback `fn` containing
|
||||
* nested suites.
|
||||
*/
|
||||
(title: string, config: Cypress.TestConfigOverrides, fn: (this: Suite) => void): Suite
|
||||
(title: string, config: Cypress.SuiteConfigOverrides, fn: (this: Suite) => void): Suite
|
||||
}
|
||||
|
||||
interface ExclusiveSuiteFunction {
|
||||
@@ -6087,10 +6096,10 @@ declare namespace Mocha {
|
||||
* Describe a "suite" with the given `title`, TestOptions, and callback `fn` containing
|
||||
* nested suites. Indicates this suite should be executed exclusively.
|
||||
*/
|
||||
(title: string, config: Cypress.TestConfigOverrides, fn: (this: Suite) => void): Suite
|
||||
(title: string, config: Cypress.SuiteConfigOverrides, fn: (this: Suite) => void): Suite
|
||||
}
|
||||
|
||||
interface PendingSuiteFunction {
|
||||
(title: string, config: Cypress.TestConfigOverrides, fn: (this: Suite) => void): Suite | void
|
||||
(title: string, config: Cypress.SuiteConfigOverrides, fn: (this: Suite) => void): Suite | void
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,12 @@ namespace CypressConfigTests {
|
||||
|
||||
// setters
|
||||
Cypress.config('baseUrl', '.') // $ExpectType void
|
||||
Cypress.config({ e2e: { baseUrl: '.' }}) // $ExpectType void
|
||||
Cypress.config({ e2e: { baseUrl: null }}) // $ExpectType void
|
||||
Cypress.config({ e2e: { baseUrl: '.', }}) // $ExpectType void
|
||||
Cypress.config({ e2e: { baseUrl: '.' }}) // $ExpectError
|
||||
Cypress.config({ e2e: { baseUrl: null }}) // $ExpectError
|
||||
Cypress.config({ e2e: { baseUrl: '.', }}) // $ExpectError
|
||||
Cypress.config({ component: { baseUrl: '.', devServer: () => ({} as any) } }) // $ExpectError
|
||||
Cypress.config({ e2e: { indexHtmlFile: 'index.html' } }) // $ExpectError
|
||||
Cypress.config({ testIsolation: 'off' }) // $ExpectError
|
||||
|
||||
Cypress.config('taskTimeout') // $ExpectType number
|
||||
Cypress.config('includeShadowDom') // $ExpectType boolean
|
||||
@@ -866,6 +867,9 @@ namespace CypressTestConfigOverridesTests {
|
||||
it('test', {
|
||||
retries: { run: 3 } // $ExpectError
|
||||
}, () => { })
|
||||
it('test', {
|
||||
testIsolation: 'off', // $ExpectError
|
||||
}, () => { })
|
||||
|
||||
it.skip('test', {}, () => {})
|
||||
it.only('test', {}, () => {})
|
||||
@@ -882,6 +886,10 @@ namespace CypressTestConfigOverridesTests {
|
||||
keystrokeDelay: 0
|
||||
}, () => {})
|
||||
|
||||
describe('suite', {
|
||||
testIsolation: 'off',
|
||||
}, () => {})
|
||||
|
||||
context('suite', {}, () => {})
|
||||
|
||||
describe('suite', {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"exactOptionalPropertyTypes": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
|
||||
Reference in New Issue
Block a user