Skip to content
Permalink
Browse files

Add debug --host option

Allow binding the inspector to a different address or hostname.

Co-authored-by: Mark Wubben <mark@novemberborn.net>
  • Loading branch information
DYefimov and novemberborn committed Mar 1, 2020
1 parent 8630636 commit 13d66519e7b69e810079673d6583dc7336a16ebe
Showing with 10 additions and 4 deletions.
  1. +3 −3 docs/recipes/debugging-with-chrome-devtools.md
  2. +6 −0 lib/cli.js
  3. +1 −1 lib/worker/subprocess.js
@@ -22,10 +22,10 @@ Run with the `--break` option to ensure the DevTools hit a breakpoint right befo
npx ava debug --break test.js
```

You can also customize the port. It defaults to `9229`:
By default the inspector listens on `127.0.0.1:9229`. You can customize the host and the port:

```console
npx ava debug --port 9230 test.js
npx ava debug --host 0.0.0.0 --port 9230 test.js
```

You'll have to add a connection for this port in the *Connection* tab. AVA only binds to `localhost`.
You'll have to add a connection for this port in the *Connection* tab.
@@ -131,6 +131,11 @@ exports.run = async () => { // eslint-disable-line complexity
description: 'Break before the test file is loaded',
type: 'boolean'
},
host: {
default: '127.0.0.1',
description: 'Address or hostname through which you can connect to the inspector',
type: 'string'
},
port: {
default: 9229,
description: 'Port on which you can connect to the inspector',
@@ -145,6 +150,7 @@ exports.run = async () => { // eslint-disable-line complexity
debug = {
break: argv.break === true,
files: argv.pattern,
host: argv.host,
port: argv.port
};
})
@@ -189,7 +189,7 @@ ipc.options.then(async options => {
dependencyTracking.install(testPath);

if (options.debug) {
require('inspector').open(options.debug.port, '127.0.0.1', true);
require('inspector').open(options.debug.port, options.debug.host, true);
if (options.debug.break) {
debugger; // eslint-disable-line no-debugger
}

0 comments on commit 13d6651

Please sign in to comment.
You can’t perform that action at this time.