diff --git a/scripts/vue-cli-2.sh b/scripts/setup-vue-cli-2.sh similarity index 77% rename from scripts/vue-cli-2.sh rename to scripts/setup-vue-cli-2.sh index 33ddba2..0dc56af 100755 --- a/scripts/vue-cli-2.sh +++ b/scripts/setup-vue-cli-2.sh @@ -43,12 +43,12 @@ apply_patch commit_all "Update app to move global styles into main.css file" step -cmd yarn add -D cypress @cypress/vue @cypress/webpack-dev-server webpack-dev-server +cmd yarn add -D https://cdn.cypress.io/beta/npm/10.0.0/linux-x64/circle-10.0-release-e7718f7489276cac2e8ad71bc57a627eb0135fbd/cypress.tgz @cypress/vue@^2.2.4 @cypress/webpack-dev-server webpack-dev-server apply_patch commit_all "Add Cypress with example component and page tests" step -cmd yarn add -D @cypress/code-coverage babel-plugin-istanbul +cmd yarn add -D @cypress/code-coverage@3.10.0-dev.1 babel-plugin-istanbul apply_patch commit_all "Configure Cypress Code Coverage plugin" diff --git a/scripts/vue-cli-3/1.patch b/scripts/setup-vue-cli-2/1.patch similarity index 64% rename from scripts/vue-cli-3/1.patch rename to scripts/setup-vue-cli-2/1.patch index 686bbf4..8942fc0 100644 --- a/scripts/vue-cli-3/1.patch +++ b/scripts/setup-vue-cli-2/1.patch @@ -1,7 +1,7 @@ -diff --git a/vue-cli-2/src/App.vue b/vue-cli-2/src/App.vue +diff --git a/setup-vue-cli-2/src/App.vue b/setup-vue-cli-2/src/App.vue index 55df315..b9ac61a 100644 ---- a/vue-cli-2/src/App.vue -+++ b/vue-cli-2/src/App.vue +--- a/setup-vue-cli-2/src/App.vue ++++ b/setup-vue-cli-2/src/App.vue @@ -18,11 +18,6 @@ export default { -diff --git a/vue-cli-2/src/main.css b/vue-cli-2/src/main.css +diff --git a/setup-vue-cli-2/src/main.css b/setup-vue-cli-2/src/main.css new file mode 100644 index 0000000..110b5e1 --- /dev/null -+++ b/vue-cli-2/src/main.css ++++ b/setup-vue-cli-2/src/main.css @@ -0,0 +1,7 @@ +body { + font-family: Avenir, Helvetica, Arial, sans-serif; @@ -27,10 +27,10 @@ index 0000000..110b5e1 + text-align: center; + color: #2c3e50; +} -diff --git a/vue-cli-2/src/main.js b/vue-cli-2/src/main.js +diff --git a/setup-vue-cli-2/src/main.js b/setup-vue-cli-2/src/main.js index 63eb05f..1d9028a 100644 ---- a/vue-cli-2/src/main.js -+++ b/vue-cli-2/src/main.js +--- a/setup-vue-cli-2/src/main.js ++++ b/setup-vue-cli-2/src/main.js @@ -1,5 +1,6 @@ import Vue from 'vue' import App from './App.vue' diff --git a/scripts/vue-cli-2/2.patch b/scripts/setup-vue-cli-2/2.patch similarity index 59% rename from scripts/vue-cli-2/2.patch rename to scripts/setup-vue-cli-2/2.patch index 6c988a3..cd94eb7 100644 --- a/scripts/vue-cli-2/2.patch +++ b/scripts/setup-vue-cli-2/2.patch @@ -1,49 +1,58 @@ -diff --git a/vue-cli-2/cypress.json b/vue-cli-2/cypress.json +diff --git a/setup-vue-cli-2/cypress.config.js b/setup-vue-cli-2/cypress.config.js new file mode 100644 -index 0000000..a57b21f +index 0000000..eabdc78 --- /dev/null -+++ b/vue-cli-2/cypress.json -@@ -0,0 +1,6 @@ -+{ -+ "component": { -+ "testFiles": "**/*.spec.ct.{js,ts,jsx,tsx}", -+ "componentFolder": "src" -+ } -+} -diff --git a/vue-cli-2/cypress/fixtures/example.json b/vue-cli-2/cypress/fixtures/example.json ++++ b/setup-vue-cli-2/cypress.config.js +@@ -0,0 +1,11 @@ ++const { defineConfig } = require('cypress') ++const { devServer } = require('@cypress/webpack-dev-server') ++const webpackConfig = require('@vue/cli-service/webpack.config') ++ ++module.exports = defineConfig({ ++ // Component testing, JavaScript, Vue CLI, Webpack ++ component: { ++ devServer, ++ devServerConfig: { webpackConfig } ++ }, ++}) +\ No newline at end of file +diff --git a/setup-vue-cli-2/cypress/fixtures/example.json b/setup-vue-cli-2/cypress/fixtures/example.json new file mode 100644 index 0000000..02e4254 --- /dev/null -+++ b/vue-cli-2/cypress/fixtures/example.json ++++ b/setup-vue-cli-2/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "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/vue-cli-2/cypress/plugins/index.js b/vue-cli-2/cypress/plugins/index.js +diff --git a/setup-vue-cli-2/cypress/component/index.html b/setup-vue-cli-2/cypress/component/index.html new file mode 100644 -index 0000000..3590bd9 +index 0000000..410b588 --- /dev/null -+++ b/vue-cli-2/cypress/plugins/index.js -@@ -0,0 +1,12 @@ -+const { startDevServer } = require('@cypress/webpack-dev-server') -+const webpackConfig = require('@vue/cli-service/webpack.config') ++++ b/setup-vue-cli-2/cypress/component/index.html +@@ -0,0 +1,14 @@ ++ ++ ++ ++ ++ ++ ++ Components App + -+module.exports = (on, config) => { -+ on('dev-server:start', (options) => { -+ return startDevServer({ -+ options, -+ webpackConfig, -+ }) -+ }) -+ return config -+} -diff --git a/vue-cli-2/cypress/support/commands.js b/vue-cli-2/cypress/support/commands.js ++ ++ ++ ++
++ ++ +\ No newline at end of file +diff --git a/setup-vue-cli-2/cypress/support/commands.js b/setup-vue-cli-2/cypress/support/commands.js new file mode 100644 index 0000000..119ab03 --- /dev/null -+++ b/vue-cli-2/cypress/support/commands.js ++++ b/setup-vue-cli-2/cypress/support/commands.js @@ -0,0 +1,25 @@ +// *********************************************** +// This example commands.js shows you how to @@ -70,40 +79,23 @@ index 0000000..119ab03 +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -diff --git a/vue-cli-2/cypress/support/index.js b/vue-cli-2/cypress/support/index.js +diff --git a/setup-vue-cli-2/cypress/support/component.js b/setup-vue-cli-2/cypress/support/component.js new file mode 100644 -index 0000000..9b7843f +index 0000000..7e654cd --- /dev/null -+++ b/vue-cli-2/cypress/support/index.js -@@ -0,0 +1,23 @@ -+// *********************************************************** -+// This example support/index.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 -+// *********************************************************** -+ ++++ b/setup-vue-cli-2/cypress/support/component.js +@@ -0,0 +1,5 @@ +// Import commands.js using ES2015 syntax: +import './commands' + -+// Alternatively you can use CommonJS syntax: -+// require('./commands') -+ +// Ensure global app styles are loaded: +import '../../src/main.css' -diff --git a/vue-cli-2/src/App.spec.ct.js b/vue-cli-2/src/App.spec.ct.js +\ No newline at end of file +diff --git a/setup-vue-cli-2/src/App.cy.js b/setup-vue-cli-2/src/App.cy.js new file mode 100644 index 0000000..4a912ba --- /dev/null -+++ b/vue-cli-2/src/App.spec.ct.js ++++ b/setup-vue-cli-2/src/App.cy.js @@ -0,0 +1,11 @@ +import { mount } from '@cypress/vue' +import App from './App.vue' @@ -116,11 +108,11 @@ index 0000000..4a912ba + cy.get('[data-test=count]').should("have.text", "Total clicks: 1") + cy.get('button').click() +}) -diff --git a/vue-cli-2/src/components/HelloWorld.spec.ct.js b/vue-cli-2/src/components/HelloWorld.spec.ct.js +diff --git a/setup-vue-cli-2/src/components/HelloWorld.cy.js b/setup-vue-cli-2/src/components/HelloWorld.cy.js new file mode 100644 index 0000000..bbbb6c3 --- /dev/null -+++ b/vue-cli-2/src/components/HelloWorld.spec.ct.js ++++ b/setup-vue-cli-2/src/components/HelloWorld.cy.js @@ -0,0 +1,11 @@ +import { mount } from '@cypress/vue' +import HelloWorld from './HelloWorld.vue' @@ -133,10 +125,10 @@ index 0000000..bbbb6c3 + }) + cy.get('h1').contains('Hello World') +}) -diff --git a/vue-cli-2/src/App.vue b/vue-cli-2/src/App.vue +diff --git a/setup-vue-cli-2/src/App.vue b/setup-vue-cli-2/src/App.vue index b9ac61a..7988bf5 100644 ---- a/vue-cli-2/src/App.vue -+++ b/vue-cli-2/src/App.vue +--- a/setup-vue-cli-2/src/App.vue ++++ b/setup-vue-cli-2/src/App.vue @@ -2,16 +2,19 @@
Vue logo @@ -158,11 +150,11 @@ index b9ac61a..7988bf5 100644 } } -diff --git a/vue-cli-2/src/components/Counter.vue b/vue-cli-2/src/components/Counter.vue +diff --git a/setup-vue-cli-2/src/components/Counter.vue b/setup-vue-cli-2/src/components/Counter.vue new file mode 100644 index 0000000..5eb6269 --- /dev/null -+++ b/vue-cli-2/src/components/Counter.vue ++++ b/setup-vue-cli-2/src/components/Counter.vue @@ -0,0 +1,20 @@ +