Skip to content

kmorfis/node-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

03 Debugging Jest

In this sample we are going to configure VS Code for debugging Jest specs.

We will start from sample 02 Controllers.

Summary steps:

  • Adding launch.json in VS Code.
  • Update launch.json to work with Jest.

Steps to build it

  • npm install to install previous sample packages:
npm install

Debugging Jest

Jest is running over node, so we could use VS Code for debugging jest specs:

Using VS Code

As we know, VS Code provides by default a node debugger:

  • Adding debug launch.json in VS Code:

Debug VS Code

IMPORTANT: .vscode/launch.json file is created on root path.

  • Configuring launch.json to single and watchAll runs:

./.vscode/launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Jest single run",
      "program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
      "args": [
        "-c",
        "./config/test/jest.json",
        "--verbose"
      ],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Jest watchAll run",
      "program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
      "args": [
        "-c",
        "./config/test/jest.json",
        "--watchAll",
        "--verbose",
        "-i"
      ],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    }
  ]
}
  • Now we could run specs in debugging mode.

About Basefactor + Lemoncode

We are an innovating team of Javascript experts, passionate about turning your ideas into robust products.

Basefactor, consultancy by Lemoncode provides consultancy and coaching services.

Lemoncode provides training services.

For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors