Try fix test:unit for vite

This commit is contained in:
Matthias 2021-11-14 11:50:33 +01:00
parent 5f241a41b2
commit 06660dba60
6 changed files with 1918 additions and 1493 deletions

View File

@ -1,13 +1,13 @@
// cypress/plugins/index.js
const { startDevServer } = require('@cypress/webpack-dev-server');
const webpackConfig = require('@vue/cli-service/webpack.config');
const path = require('path');
const { startDevServer } = require('@cypress/vite-dev-server');
module.exports = (on, config) => {
on('dev-server:start', (options) => {
return startDevServer({
options,
webpackConfig,
viteConfig: {
configFile: path.resolve(__dirname, '..', '..', 'vite.config.js'),
},
});
});
};

View File

@ -1,9 +1,20 @@
module.exports = {
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel',
// preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel',
// testMatch: ['**/tests/unit/**/*.test.[jt]s?(x)'],
globals: {
'ts-jest': {
tsConfig: 'tests/tsconfig.json',
tsconfig: 'tests/tsconfig.json',
},
},
testPathIgnorePatterns: ['/node_modules/', '/src/', '/cypress/'],
// preset: 'vite-jest',
// preset: 'ts-jest',
moduleFileExtensions: ['js', 'ts', 'json'],
transform: {
'^.+\\.ts$': 'ts-jest',
// '^.+\\.vue$': '@vue/vue2-jest',
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
};

View File

@ -41,7 +41,8 @@
"vuex-composition-helpers": "^1.1.0"
},
"devDependencies": {
"@cypress/webpack-dev-server": "^1.8.0",
"@babel/preset-env": "^7.16.4",
"@cypress/vite-dev-server": "^2.2.2",
"@types/echarts": "^4.9.13",
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^2.33.0",
@ -49,19 +50,25 @@
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^5.1.0",
"@vue/test-utils": "^1.3.0",
"@vue/vue2-jest": "^27.0.0-alpha.4",
"babel-core": "^7.0.0-beta.41",
"cypress": "^9.4.1",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-vue": "^7.20.0",
"jest": "~26.6.3",
"jest": "^27.3.1",
"jsdom-global": "^3.0.2",
"mutationobserver-shim": "^0.3.7",
"pify": "^5.0.0",
"popper.js": "^1.16.1",
"portal-vue": "^2.1.7",
"prettier": "^2.5.1",
"sass": "^1.49.7",
"sass-loader": "^10.1.1",
"ts-jest": "^27.0.7",
"typescript": "~4.5.5",
"vite": "^2.3.3",
"vite-jest": "^0.1.4",
"vite-plugin-vue2": "^1.5.1",
"vue-template-compiler": "^2.6.14",
"vuex-class": "^0.3.2"

View File

@ -16,7 +16,8 @@
"types": [
// "webpack-env",
// "jest",
"cypress"
"cypress",
"vite/client",
],
"paths": {
"@/*": [

View File

@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import { createVuePlugin } from 'vite-plugin-vue2';
import path from 'path';
import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig({
@ -13,8 +13,7 @@ export default defineConfig({
alias: [
{
find: '@',
replacement: path.resolve(__dirname, 'src'),
// replacement: './src/*',
replacement: resolve(__dirname, 'src'),
},
],
},
@ -24,8 +23,8 @@ export default defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "@/styles/_variables.scss";',
},
},
}
additionalData: '@import "@/styles/_variables.scss";',
},
},
},
});

3359
yarn.lock

File diff suppressed because it is too large Load Diff