Skip to content

Commit 35e1168

Browse files
committed
chore(testing) added unit testing support via jest
1 parent dc91e79 commit 35e1168

16 files changed

+5608
-2313
lines changed

Diff for: .babelrc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"modules": false,
5+
"targets": {
6+
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7+
}
8+
}],
9+
"stage-2"
10+
],
11+
"plugins": ["transform-vue-jsx", "transform-runtime"],
12+
"env": {
13+
"test": {
14+
"presets": ["env", "stage-2"],
15+
"plugins": ["transform-vue-jsx", "istanbul"]
16+
}
17+
}
18+
}

Diff for: .editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

Diff for: .eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/build/
2+
/config/
3+
/dist/
4+
/*.js
5+
/test/unit/coverage/

Diff for: .eslintrc.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// https://eslint.org/docs/user-guide/configuring
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'babel-eslint',
6+
parserOptions: {
7+
sourceType: 'module'
8+
},
9+
env: {
10+
browser: true,
11+
},
12+
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
13+
extends: 'standard',
14+
// required to lint *.vue files
15+
plugins: [
16+
'html'
17+
],
18+
// add your custom rules here
19+
rules: {
20+
// allow async-await
21+
'generator-star-spacing': 'off',
22+
'space-before-function-paren': 0,
23+
// allow debugger during development
24+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
25+
}
26+
}

Diff for: .gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.sh text eol=lf
2+
package.json text eol=lf
3+
package-lock.json text eol=lf

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ jspm_packages
4040
dist/
4141
src/critical.css
4242
.wwp-cache/
43+
/test/unit/coverage/

Diff for: jest.config.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
moduleFileExtensions: [
3+
'js',
4+
'json',
5+
'vue'
6+
],
7+
moduleNameMapper: {
8+
'^@/(.*)$': '<rootDir>/src/$1'
9+
},
10+
transform: {
11+
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
12+
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
13+
},
14+
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
15+
//setupFiles: ['<rootDir>/test/unit/setup'],
16+
coverageDirectory: '<rootDir>/test/unit/coverage',
17+
collectCoverageFrom: [
18+
'src/**/*.{js,vue}',
19+
'!src/ld-json.js',
20+
'!src/app.js',
21+
'!**/node_modules/**'
22+
]
23+
}
24+

0 commit comments

Comments
 (0)