user6600549
user6600549

Reputation:

How to debug a Deno Typescript code on Windows 10, x64

I 'm trying to debug a Deno project, but I dont know, how to debug this on Windows 10 using the lldb debugger as the documentation says.

The LLDB, on windows 10 seems to be not so easy to install.

///reference path="../../deno.d.ts"
import * as deno from 'deno';
import { color } from 'https://deno.land/x/colors/main.ts';

const s = new Set();
[*] s.add('test')

console.log(s);

[*] <-- a breakpoint

Upvotes: 4

Views: 574

Answers (2)

Aral Roca
Aral Roca

Reputation: 5919

In order to debug with Deno:

  1. Add somewhere in your code a debugger; line of code.
  2. Run with --inspect-brk flag. deno run --inspect-brk ... or deno test --inspect-brk ... to debug tests.
  3. Open chrome://inspect page on Chrome.
  4. On the Remote Target section press to "inspect".
  5. Press the Resume script execution button, the code will pause just in your breakpoint.

Reference: https://aralroca.com/blog/learn-deno-chat-app#debugging

Upvotes: 1

Austen Stone
Austen Stone

Reputation: 1069

If you use VSCode here is a launch.json I am using.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug Deno",
      "type": "node",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "deno",
      "runtimeArgs": ["run", "-A", "--inspect-brk", "index.ts"],
      "port": 9229
    }
  ]
}

Upvotes: 0

Related Questions