Skip to content

Commit

Permalink
Merge pull request #769 from patrickcate/feature/000/tree-shaking
Browse files Browse the repository at this point in the history
feat(vite): update to Vite 3 to improve component tree shaking
  • Loading branch information
patrickcate authored Dec 12, 2023
2 parents afa69c0 + a5e0991 commit 7285be1
Showing 126 changed files with 2,162 additions and 1,839 deletions.
65 changes: 65 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const path = require('path')
const vue = require('@vitejs/plugin-vue')
const { defineConfig } = require('cypress')
const codeCoverageTask = require('@cypress/code-coverage/task')
const istanbul = require('vite-plugin-istanbul')

module.exports = defineConfig({
video: false,
numTestsKeptInMemory: 5,
retries: {
runMode: 1,
openMode: 0,
},
e2e: {
// setupNodeEvents(on, config) {},
},
component: {
devServer: {
framework: 'vue',
bundler: 'vite',
viteConfig: {
logLevel: 'silent',
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@module': path.resolve(__dirname, 'node_modules'),
vue: path.resolve(
__dirname,
'node_modules',
'vue',
'dist',
'vue.esm-bundler.js'
),
},
},
plugins: [
vue(),
istanbul({
include: ['src/components', 'src/composables', 'src/utils'],
exclude: [
'node_modules',
'^src/**',
'**/*.test.js',
'**/*.stories.js',
'**/*.fixtures.js',
],
cypress: true,
requireEnv: false,
extension: ['.js', '.vue'],
}),
],
build: {
sourcemap: true,
},
},
},
setupNodeEvents(on, config) {
codeCoverageTask(on, config)

return config
},
port: 3030,
specPattern: 'src/components/**/*.test.js',
},
})
13 changes: 0 additions & 13 deletions cypress.json

This file was deleted.

File renamed without changes.
72 changes: 0 additions & 72 deletions cypress/plugins/index.js

This file was deleted.

12 changes: 12 additions & 0 deletions cypress/support/component-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
34 changes: 34 additions & 0 deletions cypress/support/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// ***********************************************************
// 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 Cypress Real Event plugin.
// https://github.com/dmtrKovalenko/cypress-real-events
import 'cypress-real-events/support'

// Import commands.js using ES2015 syntax:
import './commands'

// Import Cypress code coverage plugin.
import '@cypress/code-coverage/support'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from 'cypress/vue'

Cypress.Commands.add('mount', mount)

// Example use:
// cy.mount(MyComponent)
File renamed without changes.
Loading

0 comments on commit 7285be1

Please sign in to comment.