Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tests & 100% Code Coverage #34

Merged
merged 12 commits into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"presets": [
"es2015",
"react",
"stage-2"
]
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
build/
coverage/

npm-debug.log*
node_modules/

*.tgz

.DS_Store
*~
*~
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ language: node_js
node_js: '8.9'

before_script: npm run lint
script: npm test
script: npm test -- --coverage
after_script:
# upload coverage reports to CodeCov
- bash <(curl -s https://codecov.io/bash)
- npm run test:pub
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[![dw](https://img.shields.io/npm/dw/react-signature-canvas.svg)](https://npmjs.org/package/react-signature-canvas)
<br><!-- status / activity -->
[![build status](https://img.shields.io/travis/agilgur5/react-signature-canvas/master.svg)](https://travis-ci.org/agilgur5/react-signature-canvas)
[![code coverage](https://img.shields.io/codecov/c/gh/agilgur5/react-signature-canvas/master.svg)](https://codecov.io/gh/agilgur5/react-signature-canvas)
<br>
[![NPM](https://nodei.co/npm/react-signature-canvas.png?downloads=true&downloadRank=true&stars=true)](https://npmjs.org/package/react-signature-canvas)

Expand Down
20 changes: 20 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
moduleNameMapper: {
// allow importing of Jest as an ES Module (https://github.com/facebook/jest/pull/7571#issuecomment-498634094)
'^jest$': '<rootDir>/test-utils/jest-export.js'
},
setupFilesAfterEnv: [
// configure enzyme w/ react adapter
'<rootDir>/test-utils/configure-enzyme.js',
// polyfill window.resizeTo
'<rootDir>/test-utils/window-resizeTo.js'
],
transform: {
// use babel-jest@23 for babel@6 support (https://github.com/facebook/jest/issues/8230#issuecomment-479470547)
'\\.js$': require.resolve('babel-jest')
},
coveragePathIgnorePatterns: [
'/node_modules/', // default
'<rootDir>/test-utils/' // ignore test-utils
]
}
Loading