From 0cbf3dfeb5f7a21b8ce10a68a18dc65e41b709e4 Mon Sep 17 00:00:00 2001 From: Tim Griesser Date: Thu, 19 May 2022 10:31:19 -0400 Subject: [PATCH] fix: UNIFY-1611, add next to framework options & add tests (#21557) * fix: UNIFY-1611, add next to framework options & add tests --- cli/types/cypress.d.ts | 6 +- cli/types/tests/cypress-npm-api-test.ts | 75 +++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index e5fb9a3c3e..3531a5ef34 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -3033,9 +3033,9 @@ declare namespace Cypress { type DevServerFn = (cypressDevServerConfig: DevServerConfig, devServerConfig: ComponentDevServerOpts) => ResolvedDevServerConfig | Promise - type DevServerConfigObject = { + type DevServerConfigOptions = { bundler: 'webpack' - framework: 'react' | 'vue' | 'vue-cli' | 'nuxt' | 'create-react-app' + framework: 'react' | 'vue' | 'vue-cli' | 'nuxt' | 'create-react-app' | 'next' webpackConfig?: PickConfigOpt<'webpackConfig'> } | { bundler: 'vite' @@ -3044,7 +3044,7 @@ declare namespace Cypress { } interface ComponentConfigOptions extends Omit { - devServer: DevServerFn | DevServerConfigObject + devServer: DevServerFn | DevServerConfigOptions devServerConfig?: ComponentDevServerOpts } diff --git a/cli/types/tests/cypress-npm-api-test.ts b/cli/types/tests/cypress-npm-api-test.ts index dd2bbd9f29..4e968fc3ea 100644 --- a/cli/types/tests/cypress-npm-api-test.ts +++ b/cli/types/tests/cypress-npm-api-test.ts @@ -50,3 +50,78 @@ cypress.run().then(results => { results.status // $ExpectType "finished" } }) + +// component options +const componentConfigNextWebpack: Cypress.ConfigOptions = { + component: { + devServer: { + bundler: 'webpack', + framework: 'next', + } + } +} + +const componentConfigReactWebpack: Cypress.ConfigOptions = { + component: { + devServer: { + bundler: 'webpack', + framework: 'react', + } + } +} + +const componentConfigVueWebpack: Cypress.ConfigOptions = { + component: { + devServer: { + bundler: 'webpack', + framework: 'vue', + } + } +} + +const componentConfigVueCliWebpack: Cypress.ConfigOptions = { + component: { + devServer: { + bundler: 'webpack', + framework: 'vue-cli', + webpackConfig: {} + } + } +} + +const componentConfigNuxtWebpack: Cypress.ConfigOptions = { + component: { + devServer: { + bundler: 'webpack', + framework: 'nuxt', + webpackConfig: {} + } + } +} + +const componentConfigCRAWebpack: Cypress.ConfigOptions = { + component: { + devServer: { + bundler: 'webpack', + framework: 'create-react-app', + } + } +} + +const componentConfigViteReact: Cypress.ConfigOptions = { + component: { + devServer: { + bundler: 'vite', + framework: 'react', + } + } +} + +const componentConfigViteVue: Cypress.ConfigOptions = { + component: { + devServer: { + bundler: 'vite', + framework: 'vue', + } + } +}