Skip to content

Commit

Permalink
setup jest
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuelgsouza committed Oct 25, 2019
1 parent 25eb371 commit 9ee32b7
Show file tree
Hide file tree
Showing 4 changed files with 692 additions and 9 deletions.
12 changes: 12 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
}
21 changes: 21 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
verbose: true,
moduleFileExtensions: [
'js',
'jsx',
'json'
],
transform: {
'^.+\\.(js|jsx)?$': 'babel-jest'
},
transformIgnorePatterns: [
'/node_modules/'
],
moduleNameMapper: {
'^lodash-es$': 'lodash',
'^@/(.*)$': '<rootDir>/lib/$1'
},
testMatch: [
'**/tests/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
]
}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "An lib to calculate Body Mass Index (BMI)",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest"
},
"repository": {
"type": "git",
Expand All @@ -18,6 +18,12 @@
},
"homepage": "https://github.com/emanuelgsouza/body-mass-index-js#readme",
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"babel-jest": "^24.9.0",
"jest": "^24.9.0"
},
"dependencies": {
"lodash-es": "^4.17.15"
}
}
Loading

0 comments on commit 9ee32b7

Please sign in to comment.