Skip to content

Instantly share code, notes, and snippets.

@orlaqp
Created July 21, 2018 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orlaqp/6fecade9daf9df0af599a2440467ecc1 to your computer and use it in GitHub Desktop.
Save orlaqp/6fecade9daf9df0af599a2440467ecc1 to your computer and use it in GitHub Desktop.
VS Code configuration to debug Jest test when working on a NodeJS app using Typescript
{
"name": "Jest All",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--config",
"${workspaceRoot}/config/jest.json",
"--runInBand"
],
"console": "internalConsole",
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/dist/"],
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--config",
"${workspaceRoot}/config/jest.json",
"${fileBasenameNoExtension}.js"
],
"console": "integratedTerminal",
"sourceMaps": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "vscode-jest-tests",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--config",
"${workspaceRoot}/config/jest.json",
"${fileBasenameNoExtension}.js"
],
"console":"internalConsole",
"sourceMaps": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
}
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": [ "es2016" ], /* Specify library files to be included in the compilation: */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"outDir": "./dist", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitThis": false, /* Raise error on 'this' expressions with an implied 'any' type. */
"types": [ "node" ], /* Type declaration files to be included in compilation. */
/* Experimental Options */
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
}
}
npm install --save-dev jest ts-jest @types/jest
or
yarn add jest ts-jest @types/jest --dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment