Merge pull request #6 from roschaefer/test_setup

Test and build server setup
This commit is contained in:
Grzegorz Leoniec 2018-11-12 12:30:00 +01:00 committed by GitHub
commit 4bb1dd80ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 2023 additions and 52 deletions

12
.babelrc Normal file
View File

@ -0,0 +1,12 @@
{
"presets": [
["env", { "modules": false }]
],
"env": {
"test": {
"presets": [
["env", { "targets": { "node": "current" }}]
]
}
}
}

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
language: node_js
node_js:
- "10"
cache:
directories:
- "node_modules"
install:
- yarn install
script:
- yarn run test

22
components/Badges.spec.js Normal file
View File

@ -0,0 +1,22 @@
import { shallowMount } from '@vue/test-utils'
import Badges from './Badges.vue'
describe('Badges.vue', () => {
let wrapper
beforeEach(() => {
wrapper = shallowMount(Badges, {
})
})
it('renders', () => {
expect(wrapper.is('div')).toBe(true)
})
it('has class "hc-badges"', () => {
expect(wrapper.contains('.hc-badges')).toBe(true)
})
// TODO: add similar software tests for other components
// TODO: add more test cases in this file
})

View File

@ -5,7 +5,6 @@
"author": "Grzegorz Leoniec",
"private": true,
"scripts": {
"postinstall": "yarn styleguide:build",
"dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
"build": "nuxt build",
"start": "cross-env node server/index.js",
@ -13,8 +12,25 @@
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"styleguide": "cd ./styleguide && yarn dev",
"styleguide:build": "cd ./styleguide && yarn build:lib && cd ../ && yarn upgrade vue-cion-design-system --ignore-engines",
"test": "jest",
"precommit": "yarn lint"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
".*\\.(vue)$": "vue-jest",
"^.+\\.js$": "<rootDir>/node_modules/babel-jest"
},
"moduleNameMapper": {
"^@/(.*)$": "<rootDir>/src/$1",
"^@@/(.*)$": "<rootDir>/styleguide/src/system/$1",
"^~/(.*)$": "<rootDir>/$1"
}
},
"dependencies": {
"@nuxtjs/apollo": "^4.0.0-rc3",
"@nuxtjs/dotenv": "^1.3.0",
@ -32,15 +48,20 @@
"vue-izitoast": "^1.1.0"
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.25",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-preset-env": "^1.7.0",
"eslint": "^5.0.1",
"eslint-config-prettier": "^3.1.0",
"eslint-loader": "^2.0.0",
"eslint-plugin-prettier": "3.0.0",
"eslint-plugin-vue": "^4.0.0",
"jest": "^23.6.0",
"node-sass": "^4.9.3",
"nodemon": "^1.11.0",
"prettier": "1.14.3",
"sass-loader": "^7.1.0"
"sass-loader": "^7.1.0",
"vue-jest": "^3.0.0"
}
}

View File

@ -36,7 +36,7 @@ import DsButton from '@@/components/navigation/Button/Button'
export default {
name: 'DsCopyField',
components: {
DsButton
'ds-button': DsButton
},
props: {
/**

View File

@ -11,10 +11,11 @@ exports[`CopyField.vue matches snapshot 1`] = `
<div
class="ds-copy-field-link"
>
<ds-button
<ds-button-stub
color="soft"
ghost=""
ghost="true"
icon="copy"
linktag="button"
/>
</div>

1996
yarn.lock

File diff suppressed because it is too large Load Diff