Merge pull request #1186 from freqtrade/feat/vitest

vitest
This commit is contained in:
Matthias 2023-04-11 19:21:31 +02:00 committed by GitHub
commit 1f0d58c4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 499 additions and 2267 deletions

View File

@ -33,9 +33,6 @@ module.exports = {
overrides: [ overrides: [
{ {
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'], files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
env: {
jest: true,
},
}, },
], ],
}; };

View File

@ -21,7 +21,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-22.04 ] os: [ ubuntu-22.04 ]
node: [ "14", "16", "18"] node: [ "16", "18", "19"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -53,8 +53,8 @@ jobs:
uses: cypress-io/github-action@v5 uses: cypress-io/github-action@v5
with: with:
# build: yarn build # build: yarn build
start: yarn serve start: yarn serve --host
wait-on: 'http://localhost:3000' wait-on: 'http://127.0.0.1:3000'
- name: Build build - name: Build build
run: yarn build run: yarn build

View File

@ -1,20 +0,0 @@
module.exports = {
// preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel',
// testMatch: ['**/tests/unit/**/*.test.[jt]s?(x)'],
globals: {
'ts-jest': {
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

@ -6,7 +6,7 @@
"serve": "vite", "serve": "vite",
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"test:unit": "jest", "test:unit": "vitest",
"check-types": "vue-tsc --noEmit", "check-types": "vue-tsc --noEmit",
"lint": "eslint --ext .ts,vue src tests", "lint": "eslint --ext .ts,vue src tests",
"lint-ci": "eslint --no-fix --ext .ts,vue src tests", "lint-ci": "eslint --no-fix --ext .ts,vue src tests",
@ -43,10 +43,9 @@
"@cypress/vite-dev-server": "^5.0.5", "@cypress/vite-dev-server": "^5.0.5",
"@cypress/vue": "^5.0.5", "@cypress/vue": "^5.0.5",
"@types/echarts": "^4.9.16", "@types/echarts": "^4.9.16",
"@types/jest": "^27.5.0",
"@typescript-eslint/eslint-plugin": "^2.33.0", "@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^5.57.1", "@typescript-eslint/parser": "^5.57.1",
"@vitejs/plugin-vue": "^2.3.4", "@vitejs/plugin-vue": "^4.1.0",
"@vue/compiler-sfc": "3.2.47", "@vue/compiler-sfc": "3.2.47",
"@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^5.1.0", "@vue/eslint-config-typescript": "^5.1.0",
@ -56,16 +55,13 @@
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.4.1", "eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-vue": "^7.20.0", "eslint-plugin-vue": "^7.20.0",
"jest": "^27.5.1",
"mutationobserver-shim": "^0.3.7", "mutationobserver-shim": "^0.3.7",
"portal-vue": "^3.0.0", "portal-vue": "^3.0.0",
"prettier": "^2.8.7", "prettier": "^2.8.7",
"sass": "^1.60.0", "sass": "^1.60.0",
"sass-loader": "^13.2.2",
"ts-jest": "^27.1.4",
"typescript": "~4.9.5", "typescript": "~4.9.5",
"vite": "^2.9.14", "vite": "^4.2.1",
"vite-jest": "^0.1.4", "vitest": "^0.30.0",
"vue-tsc": "^1.2.0" "vue-tsc": "^1.2.0"
} }
} }

View File

@ -1,10 +1,5 @@
{ {
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"compilerOptions": {
"types": [
"jest",
],
},
"include": [ "include": [
"unit/*.ts", "unit/*.ts",
"unit/*.tsx" "unit/*.tsx"

View File

@ -1,3 +1,4 @@
import { describe, it, expect } from 'vitest';
import { binData } from '@/shared/charts/binCount'; import { binData } from '@/shared/charts/binCount';
describe('binCount.ts', () => { describe('binCount.ts', () => {

View File

@ -1,3 +1,4 @@
import { describe, it, expect } from 'vitest';
import { formatPercent, formatPrice, formatPriceCurrency } from '@/shared/formatters'; import { formatPercent, formatPrice, formatPriceCurrency } from '@/shared/formatters';
describe('formatters.ts', () => { describe('formatters.ts', () => {

View File

@ -1,3 +1,4 @@
import { describe, it, expect } from 'vitest';
import { import {
exportForTesting, exportForTesting,
timestampms, timestampms,

View File

@ -1,3 +1,4 @@
import { describe, it, expect } from 'vitest';
import { roundTimeframe, ROUND_DOWN, ROUND_UP } from '@/shared/timemath'; import { roundTimeframe, ROUND_DOWN, ROUND_UP } from '@/shared/timemath';
// 1651021200000 = 2022-04-27T11:05:00+00:00 // 1651021200000 = 2022-04-27T11:05:00+00:00

View File

@ -29,5 +29,6 @@ export default defineConfig({
changeOrigin: true, changeOrigin: true,
}, },
}, },
port: 3000,
}, },
}); });

2715
yarn.lock

File diff suppressed because it is too large Load Diff