Skip to content

Commit

Permalink
build: port VTL to kcd-scripts (#86)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
afontcu authored Aug 18, 2019
1 parent 40ff06e commit 726491b
Show file tree
Hide file tree
Showing 51 changed files with 4,774 additions and 1,369 deletions.
13 changes: 1 addition & 12 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"presets": [
["@babel/env", {
"modules": "commonjs",
"targets": {
"node": "current",
"browsers": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
}]
["@babel/env"]
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime"
]
}
23 changes: 5 additions & 18 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 2017,
sourceType: 'module'
},
env: {
browser: true,
jest: true
},
extends: [
'standard',
'./node_modules/kcd-scripts/eslint.js',
'plugin:vue/recommended',
'eslint:recommended',
'prettier/vue',
'plugin:prettier/recommended'
],
plugins: [
'vue'
],
plugins: ['vue'],
rules: {
'no-console': 'off'
}
'no-console': 'off',
'import/no-unresolved': 'off',
},
}
5 changes: 4 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

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

**Expected behavior**

<!-- A clear and concise description of what you expected to happen. -->

**Screenshots**

<!-- If applicable, add screenshots to help explain your problem. -->

**Related information:**

- `@testing-library/vue` version:
- `Vue` version:
- `node` version:
Expand All @@ -47,4 +49,5 @@ Relevant code or config (if any)
```

**Additional context**

<!-- Add any other context about the problem here. -->
4 changes: 2 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
proseWrap: 'always',
semi: false,
singleQuote: true
}
singleQuote: true,
}
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sudo: false
language: node_js
cache:
yarn: true
directories:
- ~/.npm
notifications:
Expand All @@ -10,10 +9,8 @@ node_js:
- '8'
- '10'
- '12'
install: yarn
script:
- yarn test
- yarn global add codecov
after_success: codecov
install: npm install
script: npm run validate
after_success: kcd-scripts travis-after-success
branches:
only: master
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,25 @@ You may also be interested in installing `jest-dom` so you can use
<script>
export default {
data: () => ({
count: 0
count: 0,
}),
methods: {
increment() {
this.count++
}
}
},
},
}
</script>
```

```js
// TestComponent.spec.js
import { render, fireEvent } from '@testing-library/vue'
import {render, fireEvent} from '@testing-library/vue'
import TestComponent from './TestComponent.vue'

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

// getByText returns the first matching node for the provided text, and
// throws an error if no elements match or if more than one match is found.
Expand Down
30 changes: 14 additions & 16 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
module.exports = {
moduleDirectories: ['node_modules', 'src'],
const merge = require('lodash.merge')
const config = require('kcd-scripts/jest')

module.exports = merge(config, {
testEnvironment: 'jsdom',
moduleFileExtensions: ['js', 'vue'],
moduleNameMapper: {
'@testing-library/vue': '<rootDir>/src/vue-testing-library.js'
'@testing-library/vue': '<rootDir>/src/vue-testing-library.js',
},
coverageDirectory: './coverage',
collectCoverageFrom: [
'**/src/**/*.js',
'!**/tests/__tests__/**',
'!**/node_modules/**'
],
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/dist/',
'<rootDir>/tests/__tests__/components/'
],
collectCoverageFrom: ['**/src/**/*.js', '!**/src/__tests__/**'],
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest',
},
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue']
}
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
testPathIgnorePatterns: [
'<rootDir>/node_modules',
'<rootDir>/src/__tests__/components',
],
})
Loading

0 comments on commit 726491b

Please sign in to comment.