Skip to content

Commit

Permalink
Add jest for unit testing logic
Browse files Browse the repository at this point in the history
There are a number of non-test files in src that have logic and this will likely
continue to grow.
  • Loading branch information
Nick Ray committed Apr 25, 2022
1 parent 82a01ff commit d534c48
Show file tree
Hide file tree
Showing 7 changed files with 7,562 additions and 906 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
report
package-lock.json
coverage
10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"extends": [
"wikimedia",
"wikimedia/node",
"wikimedia/language/es2021"
"wikimedia/language/es2021",
"plugin:jest/recommended",
"plugin:jest/style"
],
"plugins": [
"jest"
],
"env": {
"browser": true,
Expand All @@ -20,6 +25,9 @@
}
]
},
"parserOptions": {
"ecmaVersion": 13
},
"settings": {
"jsdoc": {
"mode": "typescript"
Expand Down
28 changes: 28 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/

module.exports = {
// Automatically clear mock calls, instances and results before every test
clearMocks: true,

// Automatically restore mock state and implementation before every test.
restoreMocks: true,

// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,

// An array of glob patterns indicating a set of files for which coverage
// information should be collected
collectCoverageFrom: [
'src/*.js'
],

coverageDirectory: 'coverage',

// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [
'/node_modules/'
]
};
Loading

0 comments on commit d534c48

Please sign in to comment.