Skip to content

Instantly share code, notes, and snippets.

@tiglek
Created August 29, 2020 18:53
Show Gist options
  • Save tiglek/28a33d940f2c4df5099bc9add5bffc86 to your computer and use it in GitHub Desktop.
Save tiglek/28a33d940f2c4df5099bc9add5bffc86 to your computer and use it in GitHub Desktop.
vscode debug configuration for debugging the current(selected) typescript file with jest
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Jest",
"type": "node",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"runtimeArgs": [
"--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", "--runInBand",
"--config", "${workspaceRoot}/jest.config.js", "${file}"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
@tiglek
Copy link
Author

tiglek commented Aug 29, 2020

package.json

  "devDependencies": {
    "@babel/core": "^7.11.1",
    "@babel/preset-env": "^7.11.0",
    "@babel/preset-typescript": "^7.10.4",
    "@types/jest": "^26.0.0",
    "@types/node": "^14.0.27",
    "babel-jest": "^26.3.0",
    "jest": "^26.3.0",
    "nodemon": "^2.0.4",
    "ts-node": "^8.10.2",
    "typescript": "^3.9.7"
  },

babel.config.js

module.exports = {
  presets: [ 
    [
      '@babel/preset-env', { targets: {  node: 'current'  } }
    ],
    '@babel/preset-typescript',
  ],
};

jest.config.js

 module.exports = {
  testMatch: [  "**/__tests__/**/*.[jt]s?(x)",   "**/?(*.)+(spec|test).[tj]s?(x)" ],
  "testPathIgnorePatterns": ["/node_modules/"],
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment