From d1d337a075c613ebfe765c6562d5e5e894f78261 Mon Sep 17 00:00:00 2001 From: Tim Griesser Date: Thu, 19 May 2022 10:50:56 -0400 Subject: [PATCH] fix: revert "feat: automatically find/merge config for component testing (#21432)" (#21560) This reverts commit a355ad61593df38c75e9df109b2cce740c466a61. --- .../src/ast-utils/addToCypressConfig.ts | 55 ++------- .../src/ast-utils/addToCypressConfigPlugin.ts | 112 +++--------------- .../config/src/ast-utils/astConfigHelpers.ts | 106 +---------------- packages/config/src/detect/bundleConfig.ts | 30 ----- packages/config/src/index.ts | 5 - .../assigned-defineConfig-ts/output.ts | 3 +- .../destructure-require-ts/output.ts | 3 +- .../export-default-ts/output.ts | 3 +- .../import-alias-ts/output.ts | 3 +- .../import-default-ts/output.ts | 3 +- .../module-exports-ts/output.ts | 3 +- .../adding-module-cjs/cjs-with-import/code.js | 4 - .../cjs-with-import/output.js | 7 -- .../cjs-without-import/code.js | 3 - .../cjs-without-import/output.js | 5 - .../javascript-with-import/code.js | 7 -- .../javascript-with-import/output.js | 6 - .../typescript-with-import/code.ts | 9 -- .../typescript-with-import/output.ts | 7 -- .../test/__fixtures__/has-e2e.config.js | 3 - .../addModuleCypressConfigPlugin.spec.ts | 26 ---- .../test/ast-utils/addToCypressConfig.spec.ts | 91 -------------- .../addToCypressConfigPlugin.spec.ts | 2 +- .../data-context/src/actions/WizardActions.ts | 9 +- .../launchpad/cypress/e2e/project-setup.cy.ts | 4 +- .../cypress/e2e/scaffold-project.cy.ts | 32 +---- .../launchpad/src/setup/EnvironmentSetup.vue | 5 +- .../cypress.config.js | 13 -- .../fixtures/example.json | 5 - .../support/commands.js | 25 ---- .../support/component-index.html | 12 -- .../support/component.js | 27 ----- .../pristine-module/webpack.config.js | 1 - .../pristine-npm/config/webpack.config.js | 1 - .../cypress.config.js | 13 -- .../cypress/fixtures/example.json | 5 - .../cypress/support/commands.js | 25 ---- .../cypress/support/component-index.html | 12 -- .../cypress/support/component.js | 27 ----- .../cypress.config.js | 12 -- .../cypress/support/commands.js | 25 ---- .../cypress/support/component-index.html | 12 -- .../cypress/support/component.js | 27 ----- .../projects/pristine/fixtures/example.json | 5 - 44 files changed, 47 insertions(+), 746 deletions(-) delete mode 100644 packages/config/src/detect/bundleConfig.ts delete mode 100644 packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-with-import/code.js delete mode 100644 packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-with-import/output.js delete mode 100644 packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-without-import/code.js delete mode 100644 packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-without-import/output.js delete mode 100644 packages/config/test/__babel_fixtures__/adding-module-es/javascript-with-import/code.js delete mode 100644 packages/config/test/__babel_fixtures__/adding-module-es/javascript-with-import/output.js delete mode 100644 packages/config/test/__babel_fixtures__/adding-module-es/typescript-with-import/code.ts delete mode 100644 packages/config/test/__babel_fixtures__/adding-module-es/typescript-with-import/output.ts delete mode 100644 packages/config/test/__fixtures__/has-e2e.config.js delete mode 100644 packages/config/test/ast-utils/addModuleCypressConfigPlugin.spec.ts delete mode 100644 system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/cypress.config.js delete mode 100644 system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/fixtures/example.json delete mode 100644 system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/commands.js delete mode 100644 system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/component-index.html delete mode 100644 system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/component.js delete mode 100644 system-tests/projects/pristine-module/webpack.config.js delete mode 100644 system-tests/projects/pristine-npm/config/webpack.config.js delete mode 100644 system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress.config.js delete mode 100644 system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/fixtures/example.json delete mode 100644 system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/commands.js delete mode 100644 system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component-index.html delete mode 100644 system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component.js delete mode 100644 system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress.config.js delete mode 100644 system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/commands.js delete mode 100644 system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component-index.html delete mode 100644 system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component.js delete mode 100644 system-tests/projects/pristine/fixtures/example.json diff --git a/packages/config/src/ast-utils/addToCypressConfig.ts b/packages/config/src/ast-utils/addToCypressConfig.ts index 1301bd6f49..313f6682cb 100644 --- a/packages/config/src/ast-utils/addToCypressConfig.ts +++ b/packages/config/src/ast-utils/addToCypressConfig.ts @@ -6,8 +6,8 @@ import path from 'path' import debugLib from 'debug' import { parse, print } from 'recast' -import { addCommonJSModuleImportToCypressConfigPlugin, addESModuleImportToCypressConfigPlugin, addToCypressConfigPlugin } from './addToCypressConfigPlugin' -import { addCommonJSModuleDefinition, addComponentDefinition, addE2EDefinition, addESModuleDefinition, ASTComponentDefinitionConfig, ModuleToAdd } from './astConfigHelpers' +import { addToCypressConfigPlugin } from './addToCypressConfigPlugin' +import { addComponentDefinition, addE2EDefinition, ASTComponentDefinitionConfig } from './astConfigHelpers' const debug = debugLib('cypress:config:addToCypressConfig') @@ -40,26 +40,13 @@ const debug = debugLib('cypress:config:addToCypressConfig') * ...createConfigFn() * } */ -export async function addToCypressConfig (filePath: string, code: string, toAdd: { - properties?: t.ObjectProperty[] - modules?: ModuleToAdd[] -}) { +export async function addToCypressConfig (filePath: string, code: string, toAdd: t.ObjectProperty) { try { const ast = parse(code, { parser: require('recast/parsers/typescript'), }) - for (const prop of toAdd.properties ?? []) { - traverse(ast, addToCypressConfigPlugin(prop).visitor) - } - - for (const mod of toAdd.modules ?? []) { - if (mod.type === 'ES') { - traverse(ast, addESModuleImportToCypressConfigPlugin(mod.node).visitor) - } else if (mod.type === 'CommonJS') { - traverse(ast, addCommonJSModuleImportToCypressConfigPlugin(mod.node).visitor) - } - } + traverse(ast, addToCypressConfigPlugin(toAdd).visitor) return print(ast).code } catch (e) { @@ -76,14 +63,10 @@ export interface AddProjectIdToCypressConfigOptions { export async function addProjectIdToCypressConfig (options: AddProjectIdToCypressConfigOptions) { try { let result = await fs.readFile(options.filePath, 'utf8') - const toPrint = await addToCypressConfig(options.filePath, result, { - properties: [ - t.objectProperty( - t.identifier('projectId'), - t.identifier(options.projectId), - ), - ], - }) + const toPrint = await addToCypressConfig(options.filePath, result, t.objectProperty( + t.identifier('projectId'), + t.identifier(options.projectId), + )) await fs.writeFile(options.filePath, maybeFormatWithPrettier(toPrint, options.filePath)) @@ -115,26 +98,6 @@ export interface AddTestingTypeToCypressConfigOptions { export async function addTestingTypeToCypressConfig (options: AddTestingTypeToCypressConfigOptions): Promise { const toAdd = options.info.testingType === 'e2e' ? addE2EDefinition() : addComponentDefinition(options.info) - const modulesToAdd: ModuleToAdd[] = [] - - if (options.info.testingType === 'component') { - if (options.info.bundler === 'webpack' && options.info.configPath) { - if (options.isProjectUsingESModules) { - modulesToAdd.push(addESModuleDefinition(options.info.configPath, 'webpackConfig')) - } else { - modulesToAdd.push(addCommonJSModuleDefinition(options.info.configPath, 'webpackConfig')) - } - } - - if (options.info.bundler === 'vite' && options.info.configPath) { - if (options.isProjectUsingESModules) { - modulesToAdd.push(addESModuleDefinition(options.info.configPath, 'viteConfig')) - } else { - modulesToAdd.push(addCommonJSModuleDefinition(options.info.configPath, 'viteConfig')) - } - } - } - try { let result: string | undefined = undefined let resultStatus: 'ADDED' | 'MERGED' = 'MERGED' @@ -154,7 +117,7 @@ export async function addTestingTypeToCypressConfig (options: AddTestingTypeToCy result = getEmptyCodeBlock({ outputType: pathExt as OutputExtension, isProjectUsingESModules: options.isProjectUsingESModules }) } - const toPrint = await addToCypressConfig(options.filePath, result, { properties: [toAdd], modules: modulesToAdd }) + const toPrint = await addToCypressConfig(options.filePath, result, toAdd) await fs.writeFile(options.filePath, maybeFormatWithPrettier(toPrint, options.filePath)) diff --git a/packages/config/src/ast-utils/addToCypressConfigPlugin.ts b/packages/config/src/ast-utils/addToCypressConfigPlugin.ts index 541a6182f3..e6746e9509 100644 --- a/packages/config/src/ast-utils/addToCypressConfigPlugin.ts +++ b/packages/config/src/ast-utils/addToCypressConfigPlugin.ts @@ -1,5 +1,4 @@ import type { NodePath, ParserOptions, PluginObj, Visitor } from '@babel/core' -import { last } from 'lodash' import * as t from '@babel/types' import debugLib from 'debug' import { print } from 'recast' @@ -10,20 +9,6 @@ interface AddToCypressConfigPluginOptions { shouldThrow?: boolean } -function manipulateOptions (_t: any, parserOpts: ParserOptions) { - parserOpts.errorRecovery = true - parserOpts.plugins ??= [] - if ( - parserOpts.plugins.some( - (p: any) => (Array.isArray(p) ? p[0] : p) === 'typescript', - ) - ) { - return - } - - parserOpts.plugins.push('typescript') -} - /** * Standardizes our approach to writing values into the existing * Cypress config file. Attempts to handle the pragmatic cases, @@ -156,7 +141,19 @@ export function addToCypressConfigPlugin (toAdd: t.ObjectProperty, opts: AddToCy return { name: 'addToCypressConfigPlugin', - manipulateOptions, + manipulateOptions (t, parserOpts: ParserOptions) { + parserOpts.errorRecovery = true + parserOpts.plugins ??= [] + if ( + parserOpts.plugins.some( + (p: any) => (Array.isArray(p) ? p[0] : p) === 'typescript', + ) + ) { + return + } + + parserOpts.plugins.push('typescript') + }, visitor: { Program: { enter (path) { @@ -223,77 +220,11 @@ export function addToCypressConfigPlugin (toAdd: t.ObjectProperty, opts: AddToCy } } -export function addESModuleImportToCypressConfigPlugin (toAdd: t.ImportDeclaration, opts: AddToCypressConfigPluginOptions = {}): PluginObj { - return { - name: 'addESModuleImportToCypressConfigPlugin', - manipulateOptions, - visitor: { - Program (path) { - const lastImport = last(path.get('body').filter((p) => p.isImportDeclaration())) - - if (lastImport) { - lastImport.insertAfter(toAdd) - } else { - path.get('body')?.[0]?.insertBefore(toAdd) - } - }, - }, - } -} - -export function addCommonJSModuleImportToCypressConfigPlugin (toAdd: t.Statement, opts: AddToCypressConfigPluginOptions = {}): PluginObj { - let lastRequireBeforeModuleExports: number - let lastSeenRequire: number - - return { - name: 'addCommonJSModuleImportToCypressConfigPlugin', - visitor: { - Program: { - exit (path) { - const body = path.get('body')?.[0] - - // Should never happen, unless `cypress.config.js` is empty. - if (!body) { - return - } - - const n = body.find((x) => x.node?.loc?.end.line === lastRequireBeforeModuleExports) - - if (n) { - /** - * insert the require after the last require that appears before - * module.exports, if there is some other require statements. - * const { defineConfig } = require('cypress') - * <------- Insert it here - * module.exports = {} - */ - n.insertAfter(toAdd) - } else { - /** - * Otherwise just put it at the top of the module. - */ - body.insertBefore(toAdd) - } - }, - }, - CallExpression (path) { - if (isRequire(path)) { - if (path.node.loc?.end?.line) { - lastSeenRequire = path.node.loc?.end?.line - } - } - }, - AssignmentExpression (path) { - if (t.isMemberExpression(path.node.left) && isModuleExports(path.node.left)) { - lastRequireBeforeModuleExports = lastSeenRequire - } - }, - }, - } -} - -function isRequire (p: NodePath) { - return p.node.callee.type === 'Identifier' && p.node.callee.name === 'require' +function spreadResult (expr: t.Expression, toAdd: t.ObjectProperty): t.ObjectExpression { + return t.objectExpression([ + t.spreadElement(expr), + toAdd, + ]) } function isModuleExports (node: t.MemberExpression) { @@ -304,10 +235,3 @@ function isModuleExports (node: t.MemberExpression) { node.property.name === 'exports' ) } - -function spreadResult (expr: t.Expression, toAdd: t.ObjectProperty): t.ObjectExpression { - return t.objectExpression([ - t.spreadElement(expr), - toAdd, - ]) -} diff --git a/packages/config/src/ast-utils/astConfigHelpers.ts b/packages/config/src/ast-utils/astConfigHelpers.ts index 92ca8dd7bb..5349ec194b 100644 --- a/packages/config/src/ast-utils/astConfigHelpers.ts +++ b/packages/config/src/ast-utils/astConfigHelpers.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types' -import type { WIZARD_BUNDLERS, WIZARD_FRAMEWORKS } from '@packages/scaffold-config' import { parse, visit } from 'recast' import dedent from 'dedent' import assert from 'assert' @@ -27,10 +26,8 @@ export function addE2EDefinition (): t.ObjectProperty { export interface ASTComponentDefinitionConfig { testingType: 'component' - bundler: typeof WIZARD_BUNDLERS[number]['type'] - configPath?: string - framework?: typeof WIZARD_FRAMEWORKS[number]['configFramework'] - needsExplicitConfig: boolean + bundler: 'vite' | 'webpack' + framework?: string } /** @@ -44,66 +41,12 @@ export interface ASTComponentDefinitionConfig { * } */ export function addComponentDefinition (config: ASTComponentDefinitionConfig): t.ObjectProperty { - const bundlers = { - vite: { - name: 'Vite', - key: 'viteConfig', - }, - webpack: { - name: 'webpack', - key: 'webpackConfig', - }, - } as const - - if (config.bundler === 'webpack' && config.needsExplicitConfig && config.configPath) { - return extractProperty(` - const toMerge = { - component: { - devServer: { - framework: ${config.framework ? `'${config.framework}'` : 'undefined'}, - bundler: '${config.bundler}', - webpackConfig, - }, - }, - } - `) - } - - if (config.bundler === 'vite' && config.needsExplicitConfig && config.configPath) { - return extractProperty(` - const toMerge = { - component: { - devServer: { - framework: ${config.framework ? `'${config.framework}'` : 'undefined'}, - bundler: '${config.bundler}', - viteConfig, - }, - }, - } - `) - } - - if (config.needsExplicitConfig) { - return extractProperty(` - const toMerge = { - component: { - devServer: { - framework: ${config.framework ? `'${config.framework}'` : 'undefined'}, - bundler: '${config.bundler}', - // provide your ${bundlers[config.bundler].name} config here... - // ${bundlers[config.bundler].key}, - }, - }, - } - `) - } - return extractProperty(` const toMerge = { component: { devServer: { framework: ${config.framework ? `'${config.framework}'` : 'undefined'}, - bundler: '${config.bundler}', + bundler: '${config.bundler}', }, }, } @@ -137,46 +80,3 @@ function extractProperty (str: string) { return toAdd } - -interface ESModuleToAdd { - node: t.ImportDeclaration - type: 'ES' -} - -interface CommonJSModuleToAdd { - node: t.Statement - type: 'CommonJS' -} - -export type ModuleToAdd = ESModuleToAdd | CommonJSModuleToAdd - -/** - * AST definition Node for: - * - * import webpackConfig from - */ -export function addESModuleDefinition (file: string, identifier: 'viteConfig' | 'webpackConfig'): ESModuleToAdd { - return { - node: t.importDeclaration( - [t.importDefaultSpecifier(t.identifier(identifier))], - t.stringLiteral(file), - ), - type: 'ES', - } -} - -/** - * AST definition Node for: - * - * const webpackConfig = require() - */ -export function addCommonJSModuleDefinition (file: string, identifier: 'viteConfig' | 'webpackConfig'): CommonJSModuleToAdd { - const parsed = parse(`const ${identifier} = require('${file}')`, { - parser: require('recast/parsers/typescript'), - }) as t.File - - return { - node: parsed.program.body[0] as t.Statement, - type: 'CommonJS', - } -} diff --git a/packages/config/src/detect/bundleConfig.ts b/packages/config/src/detect/bundleConfig.ts deleted file mode 100644 index ed9b5a8733..0000000000 --- a/packages/config/src/detect/bundleConfig.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as fs from 'fs' -import path from 'path' - -function detectConfig (projectRoot: string, dirs: string[], files: string[]): string | undefined { - for (const dir of dirs) { - for (const f of files) { - const p = path.join(projectRoot, dir, f) - - if (fs.existsSync(p)) { - return `./${path.posix.join(dir, f)}` - } - } - } - - return undefined -} - -/** - * Looks in common places for a webpack.config. - */ -export const detectRelativeWebpackConfig = (projectRoot: string) => { - return detectConfig(projectRoot, ['.', 'config'], ['webpack.config.js', 'webpack.config.ts']) -} - -/** - * Looks in common places for a vite.config. - */ -export const detectRelativeViteConfig = (projectRoot: string) => { - return detectConfig(projectRoot, ['.', 'config'], ['vite.config.js', 'vite.config.ts']) -} diff --git a/packages/config/src/index.ts b/packages/config/src/index.ts index 3fd9d4dfdb..bedb325c4c 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -3,8 +3,3 @@ export * from './browser' export { addProjectIdToCypressConfig, addToCypressConfig, addTestingTypeToCypressConfig, AddTestingTypeToCypressConfigOptions } from './ast-utils/addToCypressConfig' - -export { - detectRelativeWebpackConfig, - detectRelativeViteConfig, -} from './detect/bundleConfig' diff --git a/packages/config/test/__babel_fixtures__/adding-component/assigned-defineConfig-ts/output.ts b/packages/config/test/__babel_fixtures__/adding-component/assigned-defineConfig-ts/output.ts index 4830ae23b9..fa80f3cd05 100644 --- a/packages/config/test/__babel_fixtures__/adding-component/assigned-defineConfig-ts/output.ts +++ b/packages/config/test/__babel_fixtures__/adding-component/assigned-defineConfig-ts/output.ts @@ -4,8 +4,7 @@ const myConfig = defineConfig({ component: { devServer: { framework: "react", - bundler: "webpack", // provide your webpack config here... - // webpackConfig, + bundler: "webpack", }, }, }); diff --git a/packages/config/test/__babel_fixtures__/adding-component/destructure-require-ts/output.ts b/packages/config/test/__babel_fixtures__/adding-component/destructure-require-ts/output.ts index 76c0c56e73..83e287734d 100644 --- a/packages/config/test/__babel_fixtures__/adding-component/destructure-require-ts/output.ts +++ b/packages/config/test/__babel_fixtures__/adding-component/destructure-require-ts/output.ts @@ -4,8 +4,7 @@ export default cypressDefineConfig({ component: { devServer: { framework: "react", - bundler: "webpack", // provide your webpack config here... - // webpackConfig, + bundler: "webpack", }, }, }); diff --git a/packages/config/test/__babel_fixtures__/adding-component/export-default-ts/output.ts b/packages/config/test/__babel_fixtures__/adding-component/export-default-ts/output.ts index 57bd9b486a..2bebce4fe4 100644 --- a/packages/config/test/__babel_fixtures__/adding-component/export-default-ts/output.ts +++ b/packages/config/test/__babel_fixtures__/adding-component/export-default-ts/output.ts @@ -3,8 +3,7 @@ export default { component: { devServer: { framework: "react", - bundler: "webpack", // provide your webpack config here... - // webpackConfig, + bundler: "webpack", }, }, }; diff --git a/packages/config/test/__babel_fixtures__/adding-component/import-alias-ts/output.ts b/packages/config/test/__babel_fixtures__/adding-component/import-alias-ts/output.ts index e18aed4bea..ee8ef86a8c 100644 --- a/packages/config/test/__babel_fixtures__/adding-component/import-alias-ts/output.ts +++ b/packages/config/test/__babel_fixtures__/adding-component/import-alias-ts/output.ts @@ -4,8 +4,7 @@ export default myDefineConfig({ component: { devServer: { framework: "react", - bundler: "webpack", // provide your webpack config here... - // webpackConfig, + bundler: "webpack", }, }, }); diff --git a/packages/config/test/__babel_fixtures__/adding-component/import-default-ts/output.ts b/packages/config/test/__babel_fixtures__/adding-component/import-default-ts/output.ts index 48cc78f286..b7eecb1677 100644 --- a/packages/config/test/__babel_fixtures__/adding-component/import-default-ts/output.ts +++ b/packages/config/test/__babel_fixtures__/adding-component/import-default-ts/output.ts @@ -4,8 +4,7 @@ export default cy.defineConfig({ component: { devServer: { framework: "react", - bundler: "webpack", // provide your webpack config here... - // webpackConfig, + bundler: "webpack", }, }, }); diff --git a/packages/config/test/__babel_fixtures__/adding-component/module-exports-ts/output.ts b/packages/config/test/__babel_fixtures__/adding-component/module-exports-ts/output.ts index a7b0de28d8..37539d5ed2 100644 --- a/packages/config/test/__babel_fixtures__/adding-component/module-exports-ts/output.ts +++ b/packages/config/test/__babel_fixtures__/adding-component/module-exports-ts/output.ts @@ -3,8 +3,7 @@ module.exports = { component: { devServer: { framework: "react", - bundler: "webpack", // provide your webpack config here... - // webpackConfig, + bundler: "webpack", }, }, }; diff --git a/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-with-import/code.js b/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-with-import/code.js deleted file mode 100644 index 44a4bba49c..0000000000 --- a/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-with-import/code.js +++ /dev/null @@ -1,4 +0,0 @@ -const { defineConfig } = require('cypress') -module.exports = defineConfig({ - e2e: {} -}) \ No newline at end of file diff --git a/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-with-import/output.js b/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-with-import/output.js deleted file mode 100644 index 14359f72c3..0000000000 --- a/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-with-import/output.js +++ /dev/null @@ -1,7 +0,0 @@ -const { defineConfig } = require("cypress"); - -const webpackConfig = require("./webpack.config.js"); - -module.exports = defineConfig({ - e2e: {}, -}); \ No newline at end of file diff --git a/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-without-import/code.js b/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-without-import/code.js deleted file mode 100644 index fb9d6c6d35..0000000000 --- a/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-without-import/code.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = defineConfig({ - e2e: {} -}) \ No newline at end of file diff --git a/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-without-import/output.js b/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-without-import/output.js deleted file mode 100644 index f64651b4d6..0000000000 --- a/packages/config/test/__babel_fixtures__/adding-module-cjs/cjs-without-import/output.js +++ /dev/null @@ -1,5 +0,0 @@ -const webpackConfig = require("./webpack.config.js"); - -module.exports = defineConfig({ - e2e: {}, -}); \ No newline at end of file diff --git a/packages/config/test/__babel_fixtures__/adding-module-es/javascript-with-import/code.js b/packages/config/test/__babel_fixtures__/adding-module-es/javascript-with-import/code.js deleted file mode 100644 index 331cd07e32..0000000000 --- a/packages/config/test/__babel_fixtures__/adding-module-es/javascript-with-import/code.js +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'cypress' - -const myConfig = defineConfig({ - e2e: {} -}) - -export default myConfig \ No newline at end of file diff --git a/packages/config/test/__babel_fixtures__/adding-module-es/javascript-with-import/output.js b/packages/config/test/__babel_fixtures__/adding-module-es/javascript-with-import/output.js deleted file mode 100644 index 88aedaee7c..0000000000 --- a/packages/config/test/__babel_fixtures__/adding-module-es/javascript-with-import/output.js +++ /dev/null @@ -1,6 +0,0 @@ -import { defineConfig } from "cypress"; -import webpackConfig from "./webpack.config.js"; -const myConfig = defineConfig({ - e2e: {}, -}); -export default myConfig; \ No newline at end of file diff --git a/packages/config/test/__babel_fixtures__/adding-module-es/typescript-with-import/code.ts b/packages/config/test/__babel_fixtures__/adding-module-es/typescript-with-import/code.ts deleted file mode 100644 index 9b35b69a00..0000000000 --- a/packages/config/test/__babel_fixtures__/adding-module-es/typescript-with-import/code.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'cypress' - -export const foo: string = "" - -const myConfig = defineConfig({ - e2e: {} -}) - -export default myConfig \ No newline at end of file diff --git a/packages/config/test/__babel_fixtures__/adding-module-es/typescript-with-import/output.ts b/packages/config/test/__babel_fixtures__/adding-module-es/typescript-with-import/output.ts deleted file mode 100644 index 84c5e4cdcc..0000000000 --- a/packages/config/test/__babel_fixtures__/adding-module-es/typescript-with-import/output.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from "cypress"; -import webpackConfig from "./webpack.config.js"; -export const foo: string = ""; -const myConfig = defineConfig({ - e2e: {}, -}); -export default myConfig; \ No newline at end of file diff --git a/packages/config/test/__fixtures__/has-e2e.config.js b/packages/config/test/__fixtures__/has-e2e.config.js deleted file mode 100644 index 5d281147b0..0000000000 --- a/packages/config/test/__fixtures__/has-e2e.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - e2e: {}, -} \ No newline at end of file diff --git a/packages/config/test/ast-utils/addModuleCypressConfigPlugin.spec.ts b/packages/config/test/ast-utils/addModuleCypressConfigPlugin.spec.ts deleted file mode 100644 index 4eb6da5a50..0000000000 --- a/packages/config/test/ast-utils/addModuleCypressConfigPlugin.spec.ts +++ /dev/null @@ -1,26 +0,0 @@ -import pluginTester from 'babel-plugin-tester' -import path from 'path' -import { addESModuleImportToCypressConfigPlugin, addCommonJSModuleImportToCypressConfigPlugin } from '../../src/ast-utils/addToCypressConfigPlugin' -import { addESModuleDefinition, addCommonJSModuleDefinition } from '../../src/ast-utils/astConfigHelpers' - -pluginTester({ - pluginName: 'addToCypressConfigPlugin: ESM config w/ component with webpack config', - plugin: () => { - return addESModuleImportToCypressConfigPlugin( - addESModuleDefinition('./webpack.config.js', 'webpackConfig').node, - { shouldThrow: false }, - ) - }, - fixtures: path.join(__dirname, '..', '__babel_fixtures__', 'adding-module-es'), -}) - -pluginTester({ - pluginName: 'addToCypressConfigPlugin: CJS config w/ component with webpack config', - plugin: () => { - return addCommonJSModuleImportToCypressConfigPlugin( - addCommonJSModuleDefinition('./webpack.config.js', 'webpackConfig').node, - { shouldThrow: false }, - ) - }, - fixtures: path.join(__dirname, '..', '__babel_fixtures__', 'adding-module-cjs'), -}) diff --git a/packages/config/test/ast-utils/addToCypressConfig.spec.ts b/packages/config/test/ast-utils/addToCypressConfig.spec.ts index 4af219e497..9381b2eb09 100644 --- a/packages/config/test/ast-utils/addToCypressConfig.spec.ts +++ b/packages/config/test/ast-utils/addToCypressConfig.spec.ts @@ -116,95 +116,4 @@ describe('addToCypressConfig', () => { expect(result.result).to.eq('NEEDS_MERGE') expect(result.error.message).to.eq('Unable to automerge with the config file') }) - - it('adds component testing to e2e config', async () => { - const result = await addTestingTypeToCypressConfig({ - filePath: path.join(__dirname, '../__fixtures__/has-e2e.config.ts'), - info: { - testingType: 'component', - bundler: 'webpack', - framework: 'react', - needsExplicitConfig: true, - }, - isProjectUsingESModules: false, - }) - - expect(stub.getCall(0).lastArg.trim()).to.eq(dedent` - export default { - e2e: {}, - - component: { - devServer: { - framework: "react", - bundler: "webpack", - // provide your webpack config here... - // webpackConfig, - }, - }, - };`.trim()) - - expect(result.result).to.eq('MERGED') - }) - - it('adds vite bundler in component testing to e2e config', async () => { - const result = await addTestingTypeToCypressConfig({ - filePath: path.join(__dirname, '../__fixtures__/has-e2e.config.ts'), - info: { - testingType: 'component', - bundler: 'vite', - framework: 'react', - needsExplicitConfig: true, - }, - isProjectUsingESModules: false, - }) - - expect(stub.getCall(0).lastArg.trim()).to.eq(dedent` - export default { - e2e: {}, - - component: { - devServer: { - framework: "react", - bundler: "vite", - // provide your Vite config here... - // viteConfig, - }, - }, - };`.trim()) - - expect(result.result).to.eq('MERGED') - }) - - it('adds component testing and webpack config to e2e config', async () => { - const result = await addTestingTypeToCypressConfig({ - filePath: path.join(__dirname, '../__fixtures__/has-e2e.config.ts'), - info: { - testingType: 'component', - bundler: 'webpack', - framework: 'react', - configPath: './webpack.config.ts', - needsExplicitConfig: true, - }, - isProjectUsingESModules: true, - }) - - // we generate this using Babel which intentionally does **NOT** - // handle formatting, so the output format is kind of weird. - // we rely on the user's eslint or prettier to format this properly. - expect(stub.getCall(0).lastArg.trim()).to.eq(dedent` - import webpackConfig from "./webpack.config.ts"; - export default { - e2e: {}, - - component: { - devServer: { - framework: "react", - bundler: "webpack", - webpackConfig, - }, - }, - };`.trim()) - - expect(result.result).to.eq('MERGED') - }) }) diff --git a/packages/config/test/ast-utils/addToCypressConfigPlugin.spec.ts b/packages/config/test/ast-utils/addToCypressConfigPlugin.spec.ts index cfa1e2bf7c..ac5c16a497 100644 --- a/packages/config/test/ast-utils/addToCypressConfigPlugin.spec.ts +++ b/packages/config/test/ast-utils/addToCypressConfigPlugin.spec.ts @@ -8,7 +8,7 @@ pluginTester({ pluginName: 'addToCypressConfigPlugin: component', plugin: () => { return addToCypressConfigPlugin( - addComponentDefinition({ testingType: 'component', framework: 'react', bundler: 'webpack', needsExplicitConfig: true }), + addComponentDefinition({ testingType: 'component', framework: 'react', bundler: 'webpack' }), { shouldThrow: false }, ) }, diff --git a/packages/data-context/src/actions/WizardActions.ts b/packages/data-context/src/actions/WizardActions.ts index e5957c2e76..5f0e4519d8 100644 --- a/packages/data-context/src/actions/WizardActions.ts +++ b/packages/data-context/src/actions/WizardActions.ts @@ -4,11 +4,11 @@ import assert from 'assert' import path from 'path' import Debug from 'debug' import fs from 'fs-extra' -import { addTestingTypeToCypressConfig, AddTestingTypeToCypressConfigOptions, detectRelativeViteConfig, detectRelativeWebpackConfig } from '@packages/config' const debug = Debug('cypress:data-context:wizard-actions') import type { DataContext } from '..' +import { addTestingTypeToCypressConfig, AddTestingTypeToCypressConfigOptions } from '@packages/config' export class WizardActions { constructor (private ctx: DataContext) {} @@ -215,23 +215,18 @@ export class WizardActions { private async scaffoldConfig (testingType: 'e2e' | 'component'): Promise { debug('scaffoldConfig') - assert(this.ctx.currentProject) if (!this.ctx.lifecycleManager.metaState.hasValidConfigFile) { this.ctx.lifecycleManager.setConfigFilePath(`cypress.config.${this.ctx.lifecycleManager.fileExtensionToUse}`) } const configFilePath = this.ctx.lifecycleManager.configFilePath - const bundler = this.ctx.coreData.wizard.chosenBundler?.package ?? 'webpack' - const testingTypeInfo: AddTestingTypeToCypressConfigOptions['info'] = testingType === 'e2e' ? { testingType: 'e2e', } : { testingType: 'component', - bundler, + bundler: this.ctx.coreData.wizard.chosenBundler?.package ?? 'webpack', framework: this.ctx.coreData.wizard.chosenFramework?.configFramework, - configPath: bundler === 'vite' ? detectRelativeViteConfig(this.ctx.currentProject) : detectRelativeWebpackConfig(this.ctx.currentProject), - needsExplicitConfig: this.ctx.coreData.wizard.chosenFramework?.category === 'library' ?? false, } const result = await addTestingTypeToCypressConfig({ diff --git a/packages/launchpad/cypress/e2e/project-setup.cy.ts b/packages/launchpad/cypress/e2e/project-setup.cy.ts index 5ff1632772..966da15a4e 100644 --- a/packages/launchpad/cypress/e2e/project-setup.cy.ts +++ b/packages/launchpad/cypress/e2e/project-setup.cy.ts @@ -315,7 +315,7 @@ describe('Launchpad: Setup Project', () => { verifyChooseABrowserPage() }) - it('can setup e2e testing for a project', () => { + it('can setup e2e testing for a project selecting TS', () => { // has `typescript` in `package.json` scaffoldAndOpenProject('pristine-yarn') cy.visitLaunchpad() @@ -326,7 +326,7 @@ describe('Launchpad: Setup Project', () => { cy.contains('button', 'E2E Testing') .should('have.focus') - .click() + .realPress('Enter') cy.contains('h1', 'Configuration Files') cy.findByText('We added the following files to your project:') diff --git a/packages/launchpad/cypress/e2e/scaffold-project.cy.ts b/packages/launchpad/cypress/e2e/scaffold-project.cy.ts index da72d62d76..81b9124197 100644 --- a/packages/launchpad/cypress/e2e/scaffold-project.cy.ts +++ b/packages/launchpad/cypress/e2e/scaffold-project.cy.ts @@ -66,13 +66,14 @@ function scaffoldAndOpenCTProject (opts: { cy.visitLaunchpad() cy.contains('Welcome to Cypress!').should('be.visible') + cy.contains('[data-cy-testingtype="e2e"]', 'Not Configured') cy.contains('[data-cy-testingtype="component"]', 'Not Configured') cy.contains('Component Testing').click() cy.contains('React.js(detected)').click() cy.contains(opts.framework).click() if (opts.bundler) { - cy.contains('Pick a bundler').click() + cy.contains('Webpack(detected)').click() cy.contains(opts.bundler).click() } @@ -157,33 +158,4 @@ describe('scaffolding new projects', { defaultCommandTimeout: 7000 }, () => { scaffoldAndOpenCTProject({ name: 'pristine', framework: 'Create React App', removeFixturesFolder: false }) assertScaffoldedFilesAreCorrect({ language, testingType: 'component', ctFramework: 'Create React App (v5)', customDirectory: 'without-fixtures' }) }) - - it('scaffolds CT for a non-framework JS project', () => { - const language = 'js' - - scaffoldAndOpenCTProject({ name: 'pristine', framework: 'Vue.js 3', bundler: 'Webpack', removeFixturesFolder: true }) - assertScaffoldedFilesAreCorrect({ language, testingType: 'component', ctFramework: 'Vue.js 3 Webpack' }) - }) - - it('scaffolds CT for a non-framework ESM TS project w/ webpack.config.js detected', () => { - const language = 'ts' - - scaffoldAndOpenCTProject({ name: 'pristine-module', framework: 'Vue.js 3', bundler: 'Webpack', removeFixturesFolder: true }) - assertScaffoldedFilesAreCorrect({ language, testingType: 'component', ctFramework: 'Vue.js 3 Webpack' }) - - // since we added a valid webpack.config, the dev server starts and we are greeted - // with the choose browser screen. - cy.contains('Choose your preferred browser for component testing.') - }) - - it('scaffolds CT for a non-framework CJS JS project w/ webpack.config.js detected', () => { - const language = 'js' - - scaffoldAndOpenCTProject({ name: 'pristine-cjs-project', framework: 'Vue.js 3', bundler: 'Webpack', removeFixturesFolder: true }) - assertScaffoldedFilesAreCorrect({ language, testingType: 'component', ctFramework: 'Vue.js 3 Webpack' }) - - // since we added a valid webpack.config, the dev server starts and we are greeted - // with the choose browser screen. - cy.contains('Choose your preferred browser for component testing.') - }) }) diff --git a/packages/launchpad/src/setup/EnvironmentSetup.vue b/packages/launchpad/src/setup/EnvironmentSetup.vue index 09ce8b6f4d..4fb5df0287 100644 --- a/packages/launchpad/src/setup/EnvironmentSetup.vue +++ b/packages/launchpad/src/setup/EnvironmentSetup.vue @@ -153,6 +153,9 @@ const onBack = () => { } const canNavigateForward = computed(() => { - return props.gql.bundler !== null && props.gql.framework !== null + const { bundler, framework } = props.gql + + return bundler !== null && framework !== null }) + diff --git a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/cypress.config.js b/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/cypress.config.js deleted file mode 100644 index be92eefd00..0000000000 --- a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/cypress.config.js +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from "cypress"; - -import webpackConfig from "./webpack.config.js"; - -export default defineConfig({ - component: { - devServer: { - framework: "vue", - bundler: "webpack", - webpackConfig, - }, - }, -}); diff --git a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/fixtures/example.json b/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/fixtures/example.json deleted file mode 100644 index 02e4254378..0000000000 --- a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/commands.js b/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/commands.js deleted file mode 100644 index 66ea16ef0e..0000000000 --- a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/commands.js +++ /dev/null @@ -1,25 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) \ No newline at end of file diff --git a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/component-index.html b/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/component-index.html deleted file mode 100644 index ac6e79fd83..0000000000 --- a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/component-index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - Components App - - -
- - \ No newline at end of file diff --git a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/component.js b/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/component.js deleted file mode 100644 index b091808fa5..0000000000 --- a/system-tests/projects/pristine-module/expected-cypress-ts-component-vue.js-3-webpack/support/component.js +++ /dev/null @@ -1,27 +0,0 @@ -// *********************************************************** -// This example support/component.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') - -import { mount } from 'cypress/vue' - -Cypress.Commands.add('mount', mount) - -// Example use: -// cy.mount(MyComponent) \ No newline at end of file diff --git a/system-tests/projects/pristine-module/webpack.config.js b/system-tests/projects/pristine-module/webpack.config.js deleted file mode 100644 index b1c6ea436a..0000000000 --- a/system-tests/projects/pristine-module/webpack.config.js +++ /dev/null @@ -1 +0,0 @@ -export default {} diff --git a/system-tests/projects/pristine-npm/config/webpack.config.js b/system-tests/projects/pristine-npm/config/webpack.config.js deleted file mode 100644 index 4ba52ba2c8..0000000000 --- a/system-tests/projects/pristine-npm/config/webpack.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {} diff --git a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress.config.js b/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress.config.js deleted file mode 100644 index c96c4ca2df..0000000000 --- a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress.config.js +++ /dev/null @@ -1,13 +0,0 @@ -const { defineConfig } = require("cypress"); - -const webpackConfig = require("./config/webpack.config.js"); - -module.exports = defineConfig({ - component: { - devServer: { - framework: "vue", - bundler: "webpack", - webpackConfig, - }, - }, -}); diff --git a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/fixtures/example.json b/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/fixtures/example.json deleted file mode 100644 index 02e4254378..0000000000 --- a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/commands.js b/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/commands.js deleted file mode 100644 index 66ea16ef0e..0000000000 --- a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/commands.js +++ /dev/null @@ -1,25 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) \ No newline at end of file diff --git a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component-index.html b/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component-index.html deleted file mode 100644 index ac6e79fd83..0000000000 --- a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component-index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - Components App - - -
- - \ No newline at end of file diff --git a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component.js b/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component.js deleted file mode 100644 index b091808fa5..0000000000 --- a/system-tests/projects/pristine-npm/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component.js +++ /dev/null @@ -1,27 +0,0 @@ -// *********************************************************** -// This example support/component.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') - -import { mount } from 'cypress/vue' - -Cypress.Commands.add('mount', mount) - -// Example use: -// cy.mount(MyComponent) \ No newline at end of file diff --git a/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress.config.js b/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress.config.js deleted file mode 100644 index 35d3bcea8f..0000000000 --- a/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress.config.js +++ /dev/null @@ -1,12 +0,0 @@ -const { defineConfig } = require("cypress"); - -module.exports = defineConfig({ - component: { - devServer: { - framework: "vue", - bundler: "webpack", - // provide your webpack config here... - // webpackConfig, - }, - }, -}); diff --git a/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/commands.js b/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/commands.js deleted file mode 100644 index 119ab03f7c..0000000000 --- a/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/commands.js +++ /dev/null @@ -1,25 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) diff --git a/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component-index.html b/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component-index.html deleted file mode 100644 index 5f9622ae29..0000000000 --- a/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component-index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - Components App - - -
- - diff --git a/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component.js b/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component.js deleted file mode 100644 index b234fad447..0000000000 --- a/system-tests/projects/pristine/expected-cypress-js-component-vue.js-3-webpack/cypress/support/component.js +++ /dev/null @@ -1,27 +0,0 @@ -// *********************************************************** -// This example support/component.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') - -import { mount } from 'cypress/vue' - -Cypress.Commands.add('mount', mount) - -// Example use: -// cy.mount(MyComponent) diff --git a/system-tests/projects/pristine/fixtures/example.json b/system-tests/projects/pristine/fixtures/example.json deleted file mode 100644 index da18d9352a..0000000000 --- a/system-tests/projects/pristine/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} \ No newline at end of file