Skip to content

Commit 726491b

Browse files
authored
build: port VTL to kcd-scripts (#86)
By leveraging kcd-scripts we stay one step closer to Testing Library sibling packages while removing the need to handle linting/building/infra stuff manually.
1 parent 40ff06e commit 726491b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4774
-1369
lines changed

.babelrc

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
{
22
"presets": [
3-
["@babel/env", {
4-
"modules": "commonjs",
5-
"targets": {
6-
"node": "current",
7-
"browsers": [
8-
"> 1%",
9-
"last 2 versions",
10-
"not ie <= 8"
11-
]
12-
}
13-
}]
3+
["@babel/env"]
144
],
155
"plugins": [
16-
"@babel/plugin-proposal-object-rest-spread",
176
"@babel/plugin-transform-runtime"
187
]
198
}

.eslintrc.js

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
module.exports = {
2-
root: true,
3-
parserOptions: {
4-
parser: 'babel-eslint',
5-
ecmaVersion: 2017,
6-
sourceType: 'module'
7-
},
8-
env: {
9-
browser: true,
10-
jest: true
11-
},
122
extends: [
13-
'standard',
3+
'./node_modules/kcd-scripts/eslint.js',
144
'plugin:vue/recommended',
15-
'eslint:recommended',
165
'prettier/vue',
17-
'plugin:prettier/recommended'
18-
],
19-
plugins: [
20-
'vue'
216
],
7+
plugins: ['vue'],
228
rules: {
23-
'no-console': 'off'
24-
}
9+
'no-console': 'off',
10+
'import/no-unresolved': 'off',
11+
},
2512
}

.github/ISSUE_TEMPLATE/bug_report.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Create a report to help us improve
44
title: ''
55
labels: bug
66
assignees: ''
7-
87
---
98

109
<!-- Thanks for your interest in the project. We appreciate bugs filed and PRs submitted! -->
@@ -30,12 +29,15 @@ Steps to reproduce the behavior:
3029
<!-- Please try to provide a working demo using Codesandbox, a GitHub repo or similar! -->
3130

3231
**Expected behavior**
32+
3333
<!-- A clear and concise description of what you expected to happen. -->
3434

3535
**Screenshots**
36+
3637
<!-- If applicable, add screenshots to help explain your problem. -->
3738

3839
**Related information:**
40+
3941
- `@testing-library/vue` version:
4042
- `Vue` version:
4143
- `node` version:
@@ -47,4 +49,5 @@ Relevant code or config (if any)
4749
```
4850

4951
**Additional context**
52+
5053
<!-- Add any other context about the problem here. -->

.prettierrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
proseWrap: 'always',
33
semi: false,
4-
singleQuote: true
5-
}
4+
singleQuote: true,
5+
}

.travis.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
sudo: false
22
language: node_js
33
cache:
4-
yarn: true
54
directories:
65
- ~/.npm
76
notifications:
@@ -10,10 +9,8 @@ node_js:
109
- '8'
1110
- '10'
1211
- '12'
13-
install: yarn
14-
script:
15-
- yarn test
16-
- yarn global add codecov
17-
after_success: codecov
12+
install: npm install
13+
script: npm run validate
14+
after_success: kcd-scripts travis-after-success
1815
branches:
1916
only: master

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,25 @@ You may also be interested in installing `jest-dom` so you can use
7272
<script>
7373
export default {
7474
data: () => ({
75-
count: 0
75+
count: 0,
7676
}),
7777
methods: {
7878
increment() {
7979
this.count++
80-
}
81-
}
80+
},
81+
},
8282
}
8383
</script>
8484
```
8585

8686
```js
8787
// TestComponent.spec.js
88-
import { render, fireEvent } from '@testing-library/vue'
88+
import {render, fireEvent} from '@testing-library/vue'
8989
import TestComponent from './TestComponent.vue'
9090

9191
test('increments value on click', async () => {
9292
// The render method returns a collection of utilities to query your component.
93-
const { getByText } = render(TestComponent)
93+
const {getByText} = render(TestComponent)
9494

9595
// getByText returns the first matching node for the provided text, and
9696
// throws an error if no elements match or if more than one match is found.

jest.config.js

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
module.exports = {
2-
moduleDirectories: ['node_modules', 'src'],
1+
const merge = require('lodash.merge')
2+
const config = require('kcd-scripts/jest')
3+
4+
module.exports = merge(config, {
5+
testEnvironment: 'jsdom',
36
moduleFileExtensions: ['js', 'vue'],
47
moduleNameMapper: {
5-
'@testing-library/vue': '<rootDir>/src/vue-testing-library.js'
8+
'@testing-library/vue': '<rootDir>/src/vue-testing-library.js',
69
},
710
coverageDirectory: './coverage',
8-
collectCoverageFrom: [
9-
'**/src/**/*.js',
10-
'!**/tests/__tests__/**',
11-
'!**/node_modules/**'
12-
],
13-
testPathIgnorePatterns: [
14-
'/node_modules/',
15-
'<rootDir>/dist/',
16-
'<rootDir>/tests/__tests__/components/'
17-
],
11+
collectCoverageFrom: ['**/src/**/*.js', '!**/src/__tests__/**'],
1812
transform: {
1913
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
20-
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
14+
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest',
2115
},
22-
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue']
23-
}
16+
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
17+
testPathIgnorePatterns: [
18+
'<rootDir>/node_modules',
19+
'<rootDir>/src/__tests__/components',
20+
],
21+
})

0 commit comments

Comments
 (0)