Merge branch 'quasar-cli' of https://gitea.verdnatura.es/verdnatura/salix-front into quasar-cli
This commit is contained in:
commit
517c6c2d5f
38
.babelrc
38
.babelrc
|
@ -1,19 +1,23 @@
|
||||||
{
|
{
|
||||||
"plugins": ["@babel/plugin-syntax-dynamic-import"],
|
"plugins": [
|
||||||
"env": {
|
"@babel/plugin-syntax-dynamic-import"
|
||||||
"test": {
|
],
|
||||||
"plugins": ["dynamic-import-node"],
|
"env": {
|
||||||
"presets": [
|
"test": {
|
||||||
[
|
"plugins": [
|
||||||
"@babel/preset-env",
|
"dynamic-import-node"
|
||||||
{
|
],
|
||||||
"modules": "commonjs",
|
"presets": [
|
||||||
"targets": {
|
[
|
||||||
"node": "current"
|
"@babel/preset-env",
|
||||||
}
|
{
|
||||||
}
|
"modules": "commonjs",
|
||||||
]
|
"targets": {
|
||||||
]
|
"node": "current"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
142
.eslintrc.js
142
.eslintrc.js
|
@ -1,87 +1,87 @@
|
||||||
const { resolve } = require('path');
|
const { resolve } = require('path');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
|
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
|
||||||
// This option interrupts the configuration hierarchy at this file
|
// This option interrupts the configuration hierarchy at this file
|
||||||
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
|
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
|
||||||
root: true,
|
root: true,
|
||||||
|
|
||||||
// https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
|
// https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
|
||||||
// Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
|
// Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
|
||||||
// `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted
|
// `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration
|
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration
|
||||||
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#eslint
|
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#eslint
|
||||||
// Needed to make the parser take into account 'vue' files
|
// Needed to make the parser take into account 'vue' files
|
||||||
extraFileExtensions: ['.vue'],
|
extraFileExtensions: ['.vue'],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
project: resolve(__dirname, './tsconfig.json'),
|
project: resolve(__dirname, './tsconfig.json'),
|
||||||
tsconfigRootDir: __dirname,
|
tsconfigRootDir: __dirname,
|
||||||
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
|
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
|
||||||
sourceType: 'module', // Allows for the use of imports
|
sourceType: 'module', // Allows for the use of imports
|
||||||
},
|
},
|
||||||
|
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Rules order is important, please avoid shuffling them
|
// Rules order is important, please avoid shuffling them
|
||||||
extends: [
|
extends: [
|
||||||
// Base ESLint recommended rules
|
// Base ESLint recommended rules
|
||||||
// 'eslint:recommended',
|
// 'eslint:recommended',
|
||||||
|
|
||||||
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage
|
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage
|
||||||
// ESLint typescript rules
|
// ESLint typescript rules
|
||||||
'plugin:@typescript-eslint/recommended',
|
'plugin:@typescript-eslint/recommended',
|
||||||
// consider disabling this class of rules if linting takes too long
|
// consider disabling this class of rules if linting takes too long
|
||||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||||
|
|
||||||
// Uncomment any of the lines below to choose desired strictness,
|
// Uncomment any of the lines below to choose desired strictness,
|
||||||
// but leave only one uncommented!
|
// but leave only one uncommented!
|
||||||
// See https://eslint.vuejs.org/rules/#available-rules
|
// See https://eslint.vuejs.org/rules/#available-rules
|
||||||
'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention)
|
'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention)
|
||||||
// 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
// 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
||||||
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
||||||
|
|
||||||
// https://github.com/prettier/eslint-config-prettier#installation
|
// https://github.com/prettier/eslint-config-prettier#installation
|
||||||
// usage with Prettier, provided by 'eslint-config-prettier'.
|
// usage with Prettier, provided by 'eslint-config-prettier'.
|
||||||
'prettier',
|
'prettier',
|
||||||
],
|
],
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
// required to apply rules which need type information
|
// required to apply rules which need type information
|
||||||
'@typescript-eslint',
|
'@typescript-eslint',
|
||||||
|
|
||||||
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
|
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
|
||||||
// required to lint *.vue files
|
// required to lint *.vue files
|
||||||
'vue',
|
'vue',
|
||||||
|
|
||||||
// https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674
|
// https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674
|
||||||
// Prettier has not been included as plugin to avoid performance impact
|
// Prettier has not been included as plugin to avoid performance impact
|
||||||
// add it as an extension for your IDE
|
// add it as an extension for your IDE
|
||||||
],
|
],
|
||||||
|
|
||||||
globals: {
|
globals: {
|
||||||
ga: 'readonly', // Google Analytics
|
ga: 'readonly', // Google Analytics
|
||||||
cordova: 'readonly',
|
cordova: 'readonly',
|
||||||
__statics: 'readonly',
|
__statics: 'readonly',
|
||||||
__QUASAR_SSR__: 'readonly',
|
__QUASAR_SSR__: 'readonly',
|
||||||
__QUASAR_SSR_SERVER__: 'readonly',
|
__QUASAR_SSR_SERVER__: 'readonly',
|
||||||
__QUASAR_SSR_CLIENT__: 'readonly',
|
__QUASAR_SSR_CLIENT__: 'readonly',
|
||||||
__QUASAR_SSR_PWA__: 'readonly',
|
__QUASAR_SSR_PWA__: 'readonly',
|
||||||
process: 'readonly',
|
process: 'readonly',
|
||||||
Capacitor: 'readonly',
|
Capacitor: 'readonly',
|
||||||
chrome: 'readonly',
|
chrome: 'readonly',
|
||||||
},
|
},
|
||||||
|
|
||||||
// add your custom rules here
|
// add your custom rules here
|
||||||
rules: {
|
rules: {
|
||||||
'prefer-promise-reject-errors': 'off',
|
'prefer-promise-reject-errors': 'off',
|
||||||
|
|
||||||
// TypeScript
|
// TypeScript
|
||||||
quotes: ['warn', 'single', { avoidEscape: true }],
|
quotes: ['warn', 'single', { avoidEscape: true }],
|
||||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
|
|
||||||
// allow debugger during development only
|
// allow debugger during development only
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
// to edit target browsers: use "browserslist" field in package.json
|
// to edit target browsers: use "browserslist" field in package.json
|
||||||
require('autoprefixer'),
|
require('autoprefixer'),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,10 +3,29 @@
|
||||||
"editor.guides.bracketPairs": true,
|
"editor.guides.bracketPairs": true,
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
|
"editor.codeActionsOnSave": [
|
||||||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"],
|
"source.fixAll.eslint"
|
||||||
|
],
|
||||||
|
"eslint.validate": [
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"vue"
|
||||||
|
],
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"[typescript]": {
|
"[typescript]": {
|
||||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||||
|
},
|
||||||
|
"[jsonc]": {
|
||||||
|
"editor.defaultFormatter": "vscode.json-language-features"
|
||||||
|
},
|
||||||
|
"[json]": {
|
||||||
|
"editor.defaultFormatter": "vscode.json-language-features"
|
||||||
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||||
|
},
|
||||||
|
"[vue]": {
|
||||||
|
"editor.defaultFormatter": "johnsoncodehk.volar"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,10 +9,10 @@ let extend = undefined;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (fs.existsSync('./.babelrc')) {
|
if (fs.existsSync('./.babelrc')) {
|
||||||
extend = './.babelrc';
|
extend = './.babelrc';
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
presets: ['@quasar/babel-preset-app'],
|
presets: ['@quasar/babel-preset-app'],
|
||||||
extends: extend,
|
extends: extend,
|
||||||
};
|
};
|
||||||
|
|
146
jest.config.js
146
jest.config.js
|
@ -2,80 +2,80 @@ const esModules = ['quasar', 'quasar/lang', 'lodash-es'].join('|');
|
||||||
|
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
globals: {
|
globals: {
|
||||||
__DEV__: true,
|
__DEV__: true,
|
||||||
// TODO: Remove if resolved natively
|
// TODO: Remove if resolved natively
|
||||||
// See https://github.com/vuejs/vue-jest/issues/175
|
// See https://github.com/vuejs/vue-jest/issues/175
|
||||||
'vue-jest': {
|
'vue-jest': {
|
||||||
pug: { doctype: 'html' },
|
pug: { doctype: 'html' },
|
||||||
|
},
|
||||||
|
// Remove if using `const enums`
|
||||||
|
// See https://huafu.github.io/ts-jest/user/config/isolatedModules#example
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// Remove if using `const enums`
|
// noStackTrace: true,
|
||||||
// See https://huafu.github.io/ts-jest/user/config/isolatedModules#example
|
// bail: true,
|
||||||
'ts-jest': {
|
// cache: false,
|
||||||
isolatedModules: true,
|
// verbose: true,
|
||||||
|
// watch: true,
|
||||||
|
collectCoverage: false,
|
||||||
|
coverageDirectory: '<rootDir>/test/jest/coverage',
|
||||||
|
collectCoverageFrom: [
|
||||||
|
'<rootDir>/src/**/*.vue',
|
||||||
|
'<rootDir>/src/**/*.js',
|
||||||
|
'<rootDir>/src/**/*.ts',
|
||||||
|
'<rootDir>/src/**/*.jsx',
|
||||||
|
'<rootDir>/src/**/*.tsx',
|
||||||
|
],
|
||||||
|
coveragePathIgnorePatterns: ['/node_modules/', '.d.ts$'],
|
||||||
|
coverageThreshold: {
|
||||||
|
global: {
|
||||||
|
// branches: 50,
|
||||||
|
// functions: 50,
|
||||||
|
// lines: 50,
|
||||||
|
// statements: 50
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
testMatch: [
|
||||||
// noStackTrace: true,
|
// Matches tests in any subfolder of 'src' or into 'test/jest/__tests__'
|
||||||
// bail: true,
|
// Matches all files with extension 'js', 'jsx', 'ts' and 'tsx'
|
||||||
// cache: false,
|
'<rootDir>/test/jest/__tests__/**/*.(spec|test).+(ts|js)?(x)',
|
||||||
// verbose: true,
|
'<rootDir>/src/**/*.jest.(spec|test).+(ts|js)?(x)',
|
||||||
// watch: true,
|
],
|
||||||
collectCoverage: false,
|
// Extension-less imports of components are resolved to .ts files by TS,
|
||||||
coverageDirectory: '<rootDir>/test/jest/coverage',
|
// grating correct type-checking in test files.
|
||||||
collectCoverageFrom: [
|
// Being 'vue' the first moduleFileExtension option, the very same imports
|
||||||
'<rootDir>/src/**/*.vue',
|
// will be resolved to .vue files by Jest, if both .vue and .ts files are
|
||||||
'<rootDir>/src/**/*.js',
|
// in the same folder.
|
||||||
'<rootDir>/src/**/*.ts',
|
// This guarantee a great dev experience both for testing and type-checking.
|
||||||
'<rootDir>/src/**/*.jsx',
|
// See https://github.com/vuejs/vue-jest/issues/188#issuecomment-620750728
|
||||||
'<rootDir>/src/**/*.tsx',
|
moduleFileExtensions: ['vue', 'js', 'jsx', 'json', 'ts', 'tsx'],
|
||||||
],
|
moduleNameMapper: {
|
||||||
coveragePathIgnorePatterns: ['/node_modules/', '.d.ts$'],
|
'^quasar$': 'quasar/dist/quasar.esm.prod.js',
|
||||||
coverageThreshold: {
|
'^~/(.*)$': '<rootDir>/$1',
|
||||||
global: {
|
'^src/(.*)$': '<rootDir>/src/$1',
|
||||||
// branches: 50,
|
'^app/(.*)$': '<rootDir>/$1',
|
||||||
// functions: 50,
|
'^components/(.*)$': '<rootDir>/src/components/$1',
|
||||||
// lines: 50,
|
'^layouts/(.*)$': '<rootDir>/src/layouts/$1',
|
||||||
// statements: 50
|
'^pages/(.*)$': '<rootDir>/src/pages/$1',
|
||||||
|
'^assets/(.*)$': '<rootDir>/src/assets/$1',
|
||||||
|
'^boot/(.*)$': '<rootDir>/src/boot/$1',
|
||||||
|
'.*css$': '@quasar/quasar-app-extension-testing-unit-jest/stub.css',
|
||||||
},
|
},
|
||||||
},
|
transform: {
|
||||||
testMatch: [
|
// See https://jestjs.io/docs/en/configuration.html#transformignorepatterns-array-string
|
||||||
// Matches tests in any subfolder of 'src' or into 'test/jest/__tests__'
|
[`^(${esModules}).+\\.js$`]: 'babel-jest',
|
||||||
// Matches all files with extension 'js', 'jsx', 'ts' and 'tsx'
|
'^.+\\.(ts|js|html)$': 'ts-jest',
|
||||||
'<rootDir>/test/jest/__tests__/**/*.(spec|test).+(ts|js)?(x)',
|
// vue-jest uses find-babel-file, which searches by this order:
|
||||||
'<rootDir>/src/**/*.jest.(spec|test).+(ts|js)?(x)',
|
// (async) .babelrc, .babelrc.js, package.json, babel.config.js
|
||||||
],
|
// (sync) .babelrc, .babelrc.js, babel.config.js, package.json
|
||||||
// Extension-less imports of components are resolved to .ts files by TS,
|
// https://github.com/tleunen/find-babel-config/issues/33
|
||||||
// grating correct type-checking in test files.
|
'.*\\.vue$': 'vue-jest',
|
||||||
// Being 'vue' the first moduleFileExtension option, the very same imports
|
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
|
||||||
// will be resolved to .vue files by Jest, if both .vue and .ts files are
|
'jest-transform-stub',
|
||||||
// in the same folder.
|
},
|
||||||
// This guarantee a great dev experience both for testing and type-checking.
|
transformIgnorePatterns: [`node_modules/(?!(${esModules}))`],
|
||||||
// See https://github.com/vuejs/vue-jest/issues/188#issuecomment-620750728
|
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
|
||||||
moduleFileExtensions: ['vue', 'js', 'jsx', 'json', 'ts', 'tsx'],
|
|
||||||
moduleNameMapper: {
|
|
||||||
'^quasar$': 'quasar/dist/quasar.esm.prod.js',
|
|
||||||
'^~/(.*)$': '<rootDir>/$1',
|
|
||||||
'^src/(.*)$': '<rootDir>/src/$1',
|
|
||||||
'^app/(.*)$': '<rootDir>/$1',
|
|
||||||
'^components/(.*)$': '<rootDir>/src/components/$1',
|
|
||||||
'^layouts/(.*)$': '<rootDir>/src/layouts/$1',
|
|
||||||
'^pages/(.*)$': '<rootDir>/src/pages/$1',
|
|
||||||
'^assets/(.*)$': '<rootDir>/src/assets/$1',
|
|
||||||
'^boot/(.*)$': '<rootDir>/src/boot/$1',
|
|
||||||
'.*css$': '@quasar/quasar-app-extension-testing-unit-jest/stub.css',
|
|
||||||
},
|
|
||||||
transform: {
|
|
||||||
// See https://jestjs.io/docs/en/configuration.html#transformignorepatterns-array-string
|
|
||||||
[`^(${esModules}).+\\.js$`]: 'babel-jest',
|
|
||||||
'^.+\\.(ts|js|html)$': 'ts-jest',
|
|
||||||
// vue-jest uses find-babel-file, which searches by this order:
|
|
||||||
// (async) .babelrc, .babelrc.js, package.json, babel.config.js
|
|
||||||
// (sync) .babelrc, .babelrc.js, babel.config.js, package.json
|
|
||||||
// https://github.com/tleunen/find-babel-config/issues/33
|
|
||||||
'.*\\.vue$': 'vue-jest',
|
|
||||||
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
|
|
||||||
'jest-transform-stub',
|
|
||||||
},
|
|
||||||
transformIgnorePatterns: [`node_modules/(?!(${esModules}))`],
|
|
||||||
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
|
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
116
package.json
116
package.json
|
@ -1,59 +1,59 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Salix front-end",
|
"description": "Salix front-end",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Salix",
|
"author": "Salix",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint --ext .js,.ts,.vue ./",
|
"lint": "eslint --ext .js,.ts,.vue ./",
|
||||||
"format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore",
|
"format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore",
|
||||||
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
||||||
"test:unit": "jest --updateSnapshot",
|
"test:unit": "jest --updateSnapshot",
|
||||||
"test:unit:ci": "jest --ci",
|
"test:unit:ci": "jest --ci",
|
||||||
"test:unit:coverage": "jest --coverage",
|
"test:unit:coverage": "jest --coverage",
|
||||||
"test:unit:watch": "jest --watch",
|
"test:unit:watch": "jest --watch",
|
||||||
"test:unit:watchAll": "jest --watchAll",
|
"test:unit:watchAll": "jest --watchAll",
|
||||||
"serve:test:coverage": "quasar serve test/jest/coverage/lcov-report/ --port 8788",
|
"serve:test:coverage": "quasar serve test/jest/coverage/lcov-report/ --port 8788",
|
||||||
"concurrently:dev:jest": "concurrently \"quasar dev\" \"jest --watch\""
|
"concurrently:dev:jest": "concurrently \"quasar dev\" \"jest --watch\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@quasar/extras": "^1.0.0",
|
"@quasar/extras": "^1.0.0",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"quasar": "^2.0.0",
|
"quasar": "^2.0.0",
|
||||||
"vue": "^3.0.0",
|
"vue": "^3.0.0",
|
||||||
"vue-i18n": "^9.0.0",
|
"vue-i18n": "^9.0.0",
|
||||||
"vue-router": "^4.0.0"
|
"vue-router": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/eslint-parser": "^7.13.14",
|
"@babel/eslint-parser": "^7.13.14",
|
||||||
"@intlify/vue-i18n-loader": "^4.1.0",
|
"@intlify/vue-i18n-loader": "^4.1.0",
|
||||||
"@quasar/app": "^3.0.0",
|
"@quasar/app": "^3.0.0",
|
||||||
"@quasar/quasar-app-extension-testing-unit-jest": "^3.0.0-alpha.8",
|
"@quasar/quasar-app-extension-testing-unit-jest": "^3.0.0-alpha.8",
|
||||||
"@types/node": "^12.20.21",
|
"@types/node": "^12.20.21",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
||||||
"@typescript-eslint/parser": "^5.10.0",
|
"@typescript-eslint/parser": "^5.10.0",
|
||||||
"eslint": "^7.14.0",
|
"eslint": "^7.14.0",
|
||||||
"eslint-config-prettier": "^8.1.0",
|
"eslint-config-prettier": "^8.1.0",
|
||||||
"eslint-plugin-jest": "^25.2.2",
|
"eslint-plugin-jest": "^25.2.2",
|
||||||
"eslint-plugin-vue": "^7.0.0",
|
"eslint-plugin-vue": "^7.0.0",
|
||||||
"prettier": "^2.5.1"
|
"prettier": "^2.5.1"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 10 Chrome versions",
|
"last 10 Chrome versions",
|
||||||
"last 10 Firefox versions",
|
"last 10 Firefox versions",
|
||||||
"last 4 Edge versions",
|
"last 4 Edge versions",
|
||||||
"last 7 Safari versions",
|
"last 7 Safari versions",
|
||||||
"last 8 Android versions",
|
"last 8 Android versions",
|
||||||
"last 8 ChromeAndroid versions",
|
"last 8 ChromeAndroid versions",
|
||||||
"last 8 FirefoxAndroid versions",
|
"last 8 FirefoxAndroid versions",
|
||||||
"last 10 iOS versions",
|
"last 10 iOS versions",
|
||||||
"last 5 Opera versions"
|
"last 5 Opera versions"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 12.22.1",
|
"node": ">= 12.22.1",
|
||||||
"npm": ">= 6.13.4",
|
"npm": ">= 6.13.4",
|
||||||
"yarn": ">= 1.21.1"
|
"yarn": ">= 1.21.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"@quasar/testing-unit-jest": {
|
"@quasar/testing-unit-jest": {
|
||||||
"babel": "babelrc",
|
"babel": "babelrc",
|
||||||
"options": [
|
"options": [
|
||||||
"scripts",
|
"scripts",
|
||||||
"typescript"
|
"typescript"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"unit-jest": {
|
"unit-jest": {
|
||||||
"runnerCommand": "jest --ci"
|
"runnerCommand": "jest --ci"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: [
|
extends: [
|
||||||
// Removes 'no-undef' lint errors for Jest global functions (`describe`, `it`, etc),
|
// Removes 'no-undef' lint errors for Jest global functions (`describe`, `it`, etc),
|
||||||
// add Jest-specific lint rules and Jest plugin
|
// add Jest-specific lint rules and Jest plugin
|
||||||
// See https://github.com/jest-community/eslint-plugin-jest#recommended
|
// See https://github.com/jest-community/eslint-plugin-jest#recommended
|
||||||
'plugin:jest/recommended',
|
'plugin:jest/recommended',
|
||||||
// Uncomment following line to apply style rules
|
// Uncomment following line to apply style rules
|
||||||
// 'plugin:jest/style',
|
// 'plugin:jest/style',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,34 +8,34 @@ import MyButton from './demo/MyButton';
|
||||||
installQuasarPlugin();
|
installQuasarPlugin();
|
||||||
|
|
||||||
describe('MyButton', () => {
|
describe('MyButton', () => {
|
||||||
it('has increment method', () => {
|
it('has increment method', () => {
|
||||||
const wrapper = mount(MyButton);
|
const wrapper = mount(MyButton);
|
||||||
const { vm } = wrapper;
|
const { vm } = wrapper;
|
||||||
|
|
||||||
expect(typeof vm.increment).toBe('function');
|
expect(typeof vm.increment).toBe('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can check the inner text content', () => {
|
it('can check the inner text content', () => {
|
||||||
const wrapper = mount(MyButton);
|
const wrapper = mount(MyButton);
|
||||||
const { vm } = wrapper;
|
const { vm } = wrapper;
|
||||||
|
|
||||||
expect((vm.$el as HTMLElement).textContent).toContain('rocket muffin');
|
expect((vm.$el as HTMLElement).textContent).toContain('rocket muffin');
|
||||||
expect(wrapper.find('.content').text()).toContain('rocket muffin');
|
expect(wrapper.find('.content').text()).toContain('rocket muffin');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets the correct default data', () => {
|
it('sets the correct default data', () => {
|
||||||
const wrapper = mount(MyButton);
|
const wrapper = mount(MyButton);
|
||||||
const { vm } = wrapper;
|
const { vm } = wrapper;
|
||||||
|
|
||||||
expect(typeof vm.counter).toBe('number');
|
expect(typeof vm.counter).toBe('number');
|
||||||
expect(vm.counter).toBe(0);
|
expect(vm.counter).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correctly updates counter when button is pressed', async () => {
|
it('correctly updates counter when button is pressed', async () => {
|
||||||
const wrapper = shallowMount(MyButton);
|
const wrapper = shallowMount(MyButton);
|
||||||
const { vm } = wrapper;
|
const { vm } = wrapper;
|
||||||
const button = wrapper.findComponent(QBtn);
|
const button = wrapper.findComponent(QBtn);
|
||||||
await button.trigger('click');
|
await button.trigger('click');
|
||||||
expect(vm.counter).toBe(1);
|
expect(vm.counter).toBe(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,13 +6,13 @@ import MyDialog from './demo/MyDialog';
|
||||||
installQuasarPlugin();
|
installQuasarPlugin();
|
||||||
|
|
||||||
describe('MyDialog', () => {
|
describe('MyDialog', () => {
|
||||||
it('should mount MyDialog', () => {
|
it('should mount MyDialog', () => {
|
||||||
const wrapper = mount(MyDialog, {
|
const wrapper = mount(MyDialog, {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
isDialogOpen: true,
|
isDialogOpen: true,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(wrapper.exists()).toBe(true);
|
expect(wrapper.exists()).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { defineComponent, ref } from 'vue';
|
import { defineComponent, ref } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'MyButton',
|
name: 'MyButton',
|
||||||
props: {
|
props: {
|
||||||
incrementStep: {
|
incrementStep: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1,
|
default: 1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
setup(props) {
|
||||||
setup(props) {
|
const counter = ref(0);
|
||||||
const counter = ref(0);
|
const input = ref('rocket muffin');
|
||||||
const input = ref('rocket muffin');
|
function increment() {
|
||||||
function increment() {
|
counter.value += props.incrementStep;
|
||||||
counter.value += props.incrementStep;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return { counter, input, increment };
|
return { counter, input, increment };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script lang="ts" src="./MyButton.ts"></script>
|
<script lang="ts" src="./MyButton.ts"></script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<p class="content">{{ input }}</p>
|
<p class="content">{{ input }}</p>
|
||||||
<span>{{ counter }}</span>
|
<span>{{ counter }}</span>
|
||||||
<q-btn class="button" @click="increment()"></q-btn>
|
<q-btn class="button" @click="increment()"></q-btn>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'MyDialog',
|
name: 'MyDialog',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isDialogOpen: false,
|
isDialogOpen: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script lang="ts" src="./MyDialog.ts"></script>
|
<script lang="ts" src="./MyDialog.ts"></script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="isDialogOpen">
|
<q-dialog v-model="isDialogOpen">
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-section>Custom dialog which should be tested</q-card-section>
|
<q-card-section>Custom dialog which should be tested</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"extends": "@quasar/app/tsconfig-preset",
|
"extends": "@quasar/app/tsconfig-preset",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "."
|
"baseUrl": "."
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue