Add Vue jest plugin, move test
This commit is contained in:
parent
1844d0d627
commit
7babcbd547
26
jest.config.js
Normal file
26
jest.config.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
module.exports = {
|
||||||
|
moduleFileExtensions: [
|
||||||
|
'js',
|
||||||
|
'jsx',
|
||||||
|
'json',
|
||||||
|
'vue'
|
||||||
|
],
|
||||||
|
transform: {
|
||||||
|
'^.+\\.vue$': 'vue-jest',
|
||||||
|
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
|
||||||
|
'^.+\\.jsx?$': 'babel-jest'
|
||||||
|
},
|
||||||
|
transformIgnorePatterns: [
|
||||||
|
'/node_modules/'
|
||||||
|
],
|
||||||
|
moduleNameMapper: {
|
||||||
|
'^@/(.*)$': '<rootDir>/src/$1'
|
||||||
|
},
|
||||||
|
snapshotSerializers: [
|
||||||
|
'jest-serializer-vue'
|
||||||
|
],
|
||||||
|
testMatch: [
|
||||||
|
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
|
||||||
|
],
|
||||||
|
testURL: 'http://localhost/'
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
[build]
|
[build]
|
||||||
command = "yarn test && yarn build"
|
command = "yarn test:unit && yarn build"
|
||||||
publish = "dist"
|
publish = "dist"
|
||||||
environment = { YARN_VERSION = "1.13.0" }
|
environment = { YARN_VERSION = "1.13.0" }
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
|
"test": "jest",
|
||||||
"lint": "vue-cli-service lint",
|
"lint": "vue-cli-service lint",
|
||||||
"test": "jest"
|
"test:unit": "vue-cli-service test:unit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"postcss-nested": "^4.1.2",
|
"postcss-nested": "^4.1.2",
|
||||||
|
@ -21,8 +22,11 @@
|
||||||
"@babel/preset-env": "^7.4.3",
|
"@babel/preset-env": "^7.4.3",
|
||||||
"@vue/cli-plugin-babel": "^3.5.1",
|
"@vue/cli-plugin-babel": "^3.5.1",
|
||||||
"@vue/cli-plugin-eslint": "^3.5.1",
|
"@vue/cli-plugin-eslint": "^3.5.1",
|
||||||
|
"@vue/cli-plugin-unit-jest": "^3.5.3",
|
||||||
"@vue/cli-service": "^3.5.1",
|
"@vue/cli-service": "^3.5.1",
|
||||||
"@vue/eslint-config-standard": "^4.0.0",
|
"@vue/eslint-config-standard": "^4.0.0",
|
||||||
|
"@vue/test-utils": "1.0.0-beta.29",
|
||||||
|
"babel-core": "7.0.0-bridge.0",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-jest": "^24.7.1",
|
"babel-jest": "^24.7.1",
|
||||||
"eslint": "^5.8.0",
|
"eslint": "^5.8.0",
|
||||||
|
|
5
tests/unit/.eslintrc.js
Normal file
5
tests/unit/.eslintrc.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
jest: true
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
const apiClient = require('../src/api-client')
|
const apiClient = require('../../src/api-client')
|
||||||
const methods = apiClient.default.methods
|
const methods = apiClient.default.methods
|
||||||
|
|
||||||
test('it can get the application types', () => {
|
test('it can get the application types', () => {
|
Reference in a new issue