reactide icon indicating copy to clipboard operation
reactide copied to clipboard

[Question] Unit Test Stack

Open guidiego opened this issue 9 years ago • 0 comments

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
      }
    }
}

guidiego avatar Apr 07 '17 23:04 guidiego