Add Vue jest plugin, move test

This commit is contained in:
Oliver Davies 2019-04-09 20:58:46 +01:00
parent 1844d0d627
commit 7babcbd547
6 changed files with 1318 additions and 36 deletions

26
jest.config.js Normal file
View 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/'
}

View file

@ -1,4 +1,4 @@
[build]
command = "yarn test && yarn build"
command = "yarn test:unit && yarn build"
publish = "dist"
environment = { YARN_VERSION = "1.13.0" }

View file

@ -5,8 +5,9 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test": "jest",
"lint": "vue-cli-service lint",
"test": "jest"
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"postcss-nested": "^4.1.2",
@ -21,8 +22,11 @@
"@babel/preset-env": "^7.4.3",
"@vue/cli-plugin-babel": "^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/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-jest": "^24.7.1",
"eslint": "^5.8.0",

5
tests/unit/.eslintrc.js Normal file
View file

@ -0,0 +1,5 @@
module.exports = {
env: {
jest: true
}
}

View file

@ -1,6 +1,6 @@
import _ from 'lodash'
const apiClient = require('../src/api-client')
const apiClient = require('../../src/api-client')
const methods = apiClient.default.methods
test('it can get the application types', () => {

1313
yarn.lock

File diff suppressed because it is too large Load diff