mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-22 11:05:17 +00:00
Add testing
This commit is contained in:
parent
9265a6de53
commit
d07de9d163
14
.eslintrc.js
14
.eslintrc.js
|
@ -1,8 +1,10 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
|
|
||||||
env: {
|
env: {
|
||||||
node: true,
|
node: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
extends: [
|
extends: [
|
||||||
// vue/recommended includes all higher levels (vue/strongly-recommended, vue/essential)
|
// vue/recommended includes all higher levels (vue/strongly-recommended, vue/essential)
|
||||||
'plugin:vue/recommended',
|
'plugin:vue/recommended',
|
||||||
|
@ -11,12 +13,15 @@ module.exports = {
|
||||||
'@vue/prettier',
|
'@vue/prettier',
|
||||||
'@vue/prettier/@typescript-eslint',
|
'@vue/prettier/@typescript-eslint',
|
||||||
],
|
],
|
||||||
|
|
||||||
parser: 'vue-eslint-parser',
|
parser: 'vue-eslint-parser',
|
||||||
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
ecmaVersion: 2020,
|
ecmaVersion: 2020,
|
||||||
},
|
},
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
|
@ -24,4 +29,13 @@ module.exports = {
|
||||||
// disable eslint no-shadow as it's causing false positives on typescript enums
|
// disable eslint no-shadow as it's causing false positives on typescript enums
|
||||||
'no-shadow': 'off',
|
'no-shadow': 'off',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
|
||||||
|
env: {
|
||||||
|
jest: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -25,3 +25,7 @@ jobs:
|
||||||
- name: Run Lint
|
- name: Run Lint
|
||||||
run: |
|
run: |
|
||||||
yarn lint-ci
|
yarn lint-ci
|
||||||
|
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
yarn test:unit
|
||||||
|
|
3
jest.config.js
Normal file
3
jest.config.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = {
|
||||||
|
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel',
|
||||||
|
};
|
|
@ -5,6 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
|
"test:unit": "vue-cli-service test:unit",
|
||||||
"lint": "vue-cli-service lint",
|
"lint": "vue-cli-service lint",
|
||||||
"lint-ci": "vue-cli-service lint --no-fix"
|
"lint-ci": "vue-cli-service lint --no-fix"
|
||||||
},
|
},
|
||||||
|
@ -27,17 +28,20 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/echarts": "^4.9.0",
|
"@types/echarts": "^4.9.0",
|
||||||
|
"@types/jest": "^24.0.19",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.33.0",
|
"@typescript-eslint/eslint-plugin": "^2.33.0",
|
||||||
"@typescript-eslint/parser": "^4.6.1",
|
"@typescript-eslint/parser": "^4.6.1",
|
||||||
"@vue/cli-plugin-babel": "~4.5.8",
|
"@vue/cli-plugin-babel": "~4.5.8",
|
||||||
"@vue/cli-plugin-eslint": "~4.5.8",
|
"@vue/cli-plugin-eslint": "~4.5.8",
|
||||||
"@vue/cli-plugin-router": "^4.5.7",
|
"@vue/cli-plugin-router": "^4.5.7",
|
||||||
"@vue/cli-plugin-typescript": "~4.5.8",
|
"@vue/cli-plugin-typescript": "~4.5.8",
|
||||||
|
"@vue/cli-plugin-unit-jest": "~4.5.0",
|
||||||
"@vue/cli-plugin-vuex": "~4.5.8",
|
"@vue/cli-plugin-vuex": "~4.5.8",
|
||||||
"@vue/cli-service": "~4.5.8",
|
"@vue/cli-service": "~4.5.8",
|
||||||
"@vue/eslint-config-airbnb": "^5.1.0",
|
"@vue/eslint-config-airbnb": "^5.1.0",
|
||||||
"@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",
|
||||||
|
"@vue/test-utils": "^1.0.3",
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.7.2",
|
||||||
"eslint-config-airbnb": "^18.2.1",
|
"eslint-config-airbnb": "^18.2.1",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
|
|
12
tests/unit/example.spec.ts
Normal file
12
tests/unit/example.spec.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { mount } from '@vue/test-utils';
|
||||||
|
import ValuePair from '@/components/ftbot/ValuePair.vue';
|
||||||
|
|
||||||
|
describe('ValuePair.vue', () => {
|
||||||
|
it('renders description when passed', () => {
|
||||||
|
const msg = 'Test description';
|
||||||
|
const wrapper = mount(ValuePair, {
|
||||||
|
propsData: { description: msg },
|
||||||
|
});
|
||||||
|
expect(wrapper.text()).toMatch(msg);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,30 +1,29 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"module": "es2020",
|
"module": "es2020",
|
||||||
// this enables stricter inference for data properties on `this`
|
"strict": true,
|
||||||
"strict": true,
|
"moduleResolution": "node",
|
||||||
// if using webpack 2+ or rollup, to leverage tree shaking:
|
"experimentalDecorators": true,
|
||||||
"moduleResolution": "node",
|
"noImplicitAny": false,
|
||||||
"experimentalDecorators": true,
|
"allowJs": true,
|
||||||
"noImplicitAny": false,
|
"sourceMap": true,
|
||||||
"allowJs": true,
|
"baseUrl": "src",
|
||||||
"sourceMap": true,
|
"types": [
|
||||||
"baseUrl": "src",
|
"webpack-env",
|
||||||
"types": [
|
"jest"
|
||||||
"webpack-env"
|
],
|
||||||
],
|
"paths": {
|
||||||
"paths": {
|
"@/*": [
|
||||||
"@/*": [
|
"./*"
|
||||||
"./*"
|
]
|
||||||
]
|
}
|
||||||
}
|
},
|
||||||
},
|
"include": [
|
||||||
"include": [
|
"src/**/*.ts",
|
||||||
"src/**/*.ts",
|
"src/**/*.tsx",
|
||||||
"src/**/*.tsx",
|
"src/**/*.vue",
|
||||||
"src/**/*.vue",
|
"tests/**/*.ts",
|
||||||
"tests/**/*.ts",
|
"tests/**/*.tsx"
|
||||||
"tests/**/*.tsx"
|
]
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user