reactide
reactide copied to clipboard
[Question] Unit Test Stack
I love wrote unit tests, and want help with this in that project, but for that I need to understanding why use a big complex stack of unit test if with jest we can use enzyme too but with a not complex approach :)
If you guys want to test you can create a this command on scripts:
"test": "jest --config jest.config.json --watch",
"test:cov": "jest --config jest.config.json --coverage",
And create an jest.config.json into root :)
{
"testPathDirs": [
"tests"
],
"setupTestFrameworkScriptFile": "<rootDir>/node_modules/jest-enzyme/lib/index.js",
"unmockedModulePathPatterns": [
"node_modules/react",
"node_modules/enzyme",
"node_modules/jasmine-enzyme"
],
"moduleDirectories": [
"node_modules",
"src"
],
"coverageDirectory": "coverage",
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"collectCoverageFrom": [
"src/**/*.js",
],
"coverageReporters": [
"html",
"lcov"
],
"coverageThreshold": {
"global": {
"statements": 95,
"branches": 95,
"functions": 95,
"lines": 95
},
"each": {
"statements": 95,
"branches": 95,
"functions": 95,
"lines": 95
}
}
}