Created
June 25, 2021 08:23
-
-
Save sabesansathananthan/cfdb05217b28e74daf1df4f2b53e446b to your computer and use it in GitHub Desktop.
Enforce JavaScript Code Quality While Commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
roots: ['<rootDir>/src'], // Find files in the src/root directory | |
collectCoverage: true, // Statistical coverage | |
coverageDirectory: 'coverage', // The folder where coverage results are output | |
coverageThreshold: { | |
// Total coverage requirements for all documents | |
global: { | |
branches: 80, | |
functions: 80, | |
lines: 80, | |
statements: 80, | |
}, | |
// Coverage requirement of the matched single file | |
// Wildcard configuration is also supported here | |
'./src/**/*.{ts,tsx}': { | |
branches: 60, | |
functions: 60, | |
lines: 60, | |
statements: 60, | |
}, | |
}, | |
// File matching unit test case | |
testMatch: ['<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}', '<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}'], | |
// Is the current environment jsdom or node | |
testEnvironment: 'jsdom', | |
// Set alias, if not set, the @ symbol will not be recognized when running single test | |
moduleNameMapper: { | |
'^@/(.*)$': '<rootDir>/src/$1', | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment