Fix unittesting after cypress addition

This commit is contained in:
Matthias 2021-12-18 11:16:15 +01:00
parent 7c68d56df8
commit 4c666c1666
6 changed files with 35 additions and 10 deletions

View File

@ -31,8 +31,8 @@ jobs:
- name: Run type check
run: yarn check-types
# - name: Run Tests
# run: yarn test:unit
- name: Run Tests
run: yarn test:unit
# - name: Cypress run
# uses: cypress-io/github-action@v2
@ -40,7 +40,7 @@ jobs:
# build: yarn build
# start: yarn start
- name: Run Component tests 🧪
- name: Run Component tests
uses: cypress-io/github-action@v2
with:
# we have already installed everything

View File

@ -1,3 +1,9 @@
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',
},
},
};

View File

@ -9,8 +9,9 @@
"lint": "vue-cli-service lint",
"check-types": "tsc --noemit",
"lint-ci": "vue-cli-service lint --no-fix",
"cypress:open": "cypress open",
"cypress:run-ct": "cypress run-ct"
"cy:open": "cypress open",
"cy:open-ct": "cypress open-ct",
"cy:run-ct": "cypress run-ct"
},
"dependencies": {
"@cypress/vue": "^2.2.3",

12
tests/tsconfig.json Normal file
View File

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

View File

@ -0,0 +1,7 @@
import { formatPercent } from '@/shared/formatters';
describe('formatters.ts', () => {
it('Format percent correctly', () => {
expect(formatPercent(0.5)).toEqual('50.000%');
});
});

View File

@ -15,7 +15,7 @@
"baseUrl": "src",
"types": [
"webpack-env",
"jest",
// "jest",
"cypress"
],
"paths": {
@ -28,10 +28,9 @@
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
"exclude": [
"node_modules",
// "tests"
]
}