Skip to content

Commit 7374c5f

Browse files
author
Ayush Krishnatray
committed
adding jest
1 parent 465a96a commit 7374c5f

File tree

11 files changed

+6749
-2949
lines changed

11 files changed

+6749
-2949
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ npm-debug.log
88
# Mac OS X
99
.DS_Store
1010
dump.rdb
11+
12+
coverage

.huskyrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"hooks": {
33
"pre-commit": "npm preCommit",
4+
"pre-push": "npm prePush"
45
}
56
}

config/CSSStub.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

config/enzyme.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/** Used in jest.config.js */
2+
import { configure } from 'enzyme';
3+
import Adapter from 'enzyme-adapter-react-16';
4+
5+
configure({ adapter: new Adapter() });

jest.config.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// Automatically clear mock calls and instances between every test
6+
clearMocks: true,
7+
8+
// An array of glob patterns indicating a set of files for which coverage information should be collected
9+
collectCoverageFrom: [
10+
'src/containers/**/*.{js,jsx}',
11+
'src/components/**/*.{js,jsx}'
12+
],
13+
14+
// The directory where Jest should output its coverage files
15+
coverageDirectory: 'coverage',
16+
17+
coverageThreshold: {
18+
global: {
19+
branches: 70,
20+
functions: 70,
21+
lines: 70,
22+
statements: 70
23+
}
24+
},
25+
26+
// An array of file extensions your modules use
27+
moduleFileExtensions: ['js', 'json', 'jsx'],
28+
29+
moduleNameMapper: {
30+
'\\.(css|scss|sass)$': '<rootDir>/config/CSSStub.js'
31+
},
32+
33+
// The paths to modules that run some code to configure or set up the testing environment before each test
34+
setupFiles: ['<rootDir>/config/enzyme.config.js'],
35+
36+
// The test environment that will be used for testing
37+
testEnvironment: 'jsdom',
38+
39+
// The glob patterns Jest uses to detect test files
40+
testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)'],
41+
42+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
43+
testPathIgnorePatterns: ['\\\\node_modules\\\\'],
44+
45+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
46+
testURL: 'http://localhost',
47+
48+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
49+
transformIgnorePatterns: ['<rootDir>/node_modules/'],
50+
51+
// Indicates whether each individual test should be reported during the run
52+
verbose: false
53+
};

0 commit comments

Comments
 (0)