Skip to content

Instantly share code, notes, and snippets.

@DGZN
Created September 15, 2020 13:35
Show Gist options
  • Save DGZN/047bba53072570808621b5d25a22028e to your computer and use it in GitHub Desktop.
Save DGZN/047bba53072570808621b5d25a22028e to your computer and use it in GitHub Desktop.
Boilerplate Configuration for NodeJs Project with Jest

PACKAGE.JSON

{
  "scripts": {
    "test": "yarn jest --watchAll"
  },
  "jest": {
    "runner": "jest-runner-eslint",
    "displayName": "TDD Test Suite",
    "watchPlugins": ["jest-runner-eslint/watch-fix"],
    "testMatch": [
      "<rootDir>/tests/**/*.js"
    ],
    "cliOptions": {
      "fix": true
    }
  },
  "husky": {
    "hooks": {
      "pre-commit": "eslint .",
      "pre-push": "yarn test"
    }
  },
  "dependencies": {
    "jest": "^26.4.2",
  },
  "devDependencies": {
    "eslint": "^7.9.0",
    "eslint-config-recommended": "^4.1.0",
    "jest-runner-eslint": "^0.10.0"
  }
}

ESLINTRC.yml

env:
  es6: true
  node: true
  jest: true
extends: 'eslint:recommended'
globals:
  Atomics: readonly
  SharedArrayBuffer: readonly
parserOptions:
  ecmaVersion: 2018
  sourceType: module
rules: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment