-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inspector: throw error when activating an already active inspector
When the user tries to activate the inspector that is already active on a different port and host, we previously just silently reset the port and host stored in the Environment without actually doing anything for that to be effective. After this patch, we throw an error telling the user to close the active inspector before invoking `inspector.open()` again.
- Loading branch information
1 parent
ce21749
commit 2912300
Showing
5 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Flags: --inspect=0 | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
common.skipIfInspectorDisabled(); | ||
|
||
const assert = require('assert'); | ||
const inspector = require('inspector'); | ||
const wsUrl = inspector.url(); | ||
assert(wsUrl.startsWith('ws://')); | ||
assert.throws(() => { | ||
inspector.open(0, undefined, false); | ||
}, { | ||
code: 'ERR_INSPECTOR_ALREADY_ACTIVATED' | ||
}) | ||
assert.strictEqual(inspector.url(), wsUrl); | ||
inspector.close(); | ||
assert.strictEqual(inspector.url(), undefined); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters