mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-24 07:59:12 -05:00
fix(unify): improve dev server config ergonomics (#19957)
This commit is contained in:
Vendored
+7
-1
@@ -1,6 +1,12 @@
|
||||
/// <reference path="./cypress-npm-api.d.ts" />
|
||||
/// <reference path="./cypress-eventemitter.d.ts" />
|
||||
|
||||
// The new Awaited type added in 4.5 would work here, but we seem to need to
|
||||
// support older versions of Typescript
|
||||
type AwaitedLike<T> = T extends PromiseLike<infer U>
|
||||
? { 0: AwaitedLike<U>; 1: U }[U extends PromiseLike<any> ? 0 : 1]
|
||||
: T
|
||||
|
||||
declare namespace Cypress {
|
||||
type FileContents = string | any[] | object
|
||||
type HistoryDirection = 'back' | 'forward'
|
||||
@@ -2988,7 +2994,7 @@ declare namespace Cypress {
|
||||
type DevServerFn<ComponentDevServerOpts = any> = (cypressConfig: DevServerConfig, devServerConfig: ComponentDevServerOpts) => ResolvedDevServerConfig | Promise<ResolvedDevServerConfig>
|
||||
interface ComponentConfigOptions<ComponentDevServerOpts = any> extends CoreConfigOptions {
|
||||
devServer: Promise<{ devServer: DevServerFn<ComponentDevServerOpts>}> | { devServer: DevServerFn<ComponentDevServerOpts> } | DevServerFn<ComponentDevServerOpts>
|
||||
devServerConfig?: ComponentDevServerOpts | Promise<ComponentDevServerOpts>
|
||||
devServerConfig?: ComponentDevServerOpts | AwaitedLike<Promise<ComponentDevServerOpts>>
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { Configuration } from "webpack";
|
||||
|
||||
declare namespace legacyDevServer {
|
||||
declare namespace CypressBabelDevServer {
|
||||
interface CypressBabelDevServerConfig {
|
||||
/**
|
||||
* Allows to adjust the webpackConfig that our dev-server will use
|
||||
@@ -31,6 +31,6 @@ declare namespace legacyDevServer {
|
||||
* @param config comes from the argument of the `pluginsFile` function
|
||||
* @param devServerConfig additional config object (create an empty object it to see how to use it)
|
||||
*/
|
||||
declare function legacyDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, devServerConfig?: legacyDevServer.CypressBabelDevServerConfig): void
|
||||
declare function CypressBabelDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, devServerConfig?: CypressBabelDevServer.CypressBabelDevServerConfig): void
|
||||
|
||||
export = legacyDevServer;
|
||||
export = CypressBabelDevServer;
|
||||
Vendored
+3
-3
@@ -1,4 +1,4 @@
|
||||
declare namespace legacyDevServer {
|
||||
declare namespace CypressCracoDevServer {
|
||||
interface CypressCracoDevServerConfig {
|
||||
/**
|
||||
* The object exported of your craco.config.js file
|
||||
@@ -27,6 +27,6 @@ declare namespace legacyDevServer {
|
||||
* @param config comes from the argument of the `pluginsFile` function
|
||||
* @param cracoConfig the object exported of your craco.config.js file
|
||||
*/
|
||||
declare function legacyDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, cracoConfig: any): void
|
||||
declare function CypressCracoDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, cracoConfig: any): void
|
||||
|
||||
export = legacyDevServer;
|
||||
export = CypressCracoDevServer;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
declare namespace legacyDevServer {
|
||||
declare namespace CypressWebpackDevServer {
|
||||
interface CypressWebpackDevServerConfig {
|
||||
/**
|
||||
* Location of the weppack.config Cypress should use
|
||||
@@ -27,6 +27,6 @@ declare namespace legacyDevServer {
|
||||
* @param config comes from the argument of the `pluginsFile` function
|
||||
* @param devServerConfig additional config object (create an empty object to see how to use it)
|
||||
*/
|
||||
declare function legacyDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, devServerConfig?: legacyDevServer.CypressWebpackDevServerConfig): void
|
||||
declare function CypressWebpackDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, devServerConfig?: CypressWebpackDevServer.CypressWebpackDevServerConfig): void
|
||||
|
||||
export = legacyDevServer;
|
||||
export = CypressWebpackDevServer;
|
||||
Vendored
+3
-10
@@ -1,11 +1,4 @@
|
||||
/**
|
||||
* Sets up a Cypress component testing environment for your NextJs application
|
||||
* @param on comes from the argument of the `pluginsFile` function
|
||||
* @param config comes from the argument of the `pluginsFile` function
|
||||
*/
|
||||
declare function legacyDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions): void
|
||||
|
||||
declare namespace legacyDevServer {
|
||||
declare namespace CypressNextDevServer {
|
||||
interface CypressNextDevServerConfig {
|
||||
/**
|
||||
* Path to an index.html file that will serve as the template in
|
||||
@@ -28,6 +21,6 @@ declare namespace legacyDevServer {
|
||||
* @param config comes from the argument of the `pluginsFile` function
|
||||
* @param devServerConfig additional config object (create an empty object to see how to use it)
|
||||
*/
|
||||
declare function legacyDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, devServerConfig?: legacyDevServer.CypressNextDevServerConfig): void
|
||||
declare function CypressNextDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, devServerConfig?: CypressNextDevServer.CypressNextDevServerConfig): void
|
||||
|
||||
export = legacyDevServer;
|
||||
export = CypressNextDevServer;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
declare namespace legacyDevServer {
|
||||
declare namespace CypressCRADevServer {
|
||||
interface CypressCRADevServerConfig {
|
||||
/**
|
||||
* Location of the weppack.config Cypress should use
|
||||
@@ -27,6 +27,6 @@ declare namespace legacyDevServer {
|
||||
* @param config comes from the argument of the `pluginsFile` function
|
||||
* @param devServerConfig additional config object (create an empty object to see how to use it)
|
||||
*/
|
||||
declare function legacyDevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, devServerConfig?: legacyDevServer.CypressCRADevServerConfig): void
|
||||
declare function CypressCRADevServer(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, devServerConfig?: CypressCRADevServer.CypressCRADevServerConfig): void
|
||||
|
||||
export = legacyDevServer;
|
||||
export = CypressCRADevServer;
|
||||
Reference in New Issue
Block a user