diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2017-11-20 23:37:50 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2017-11-20 23:37:50 +0100 |
commit | f526deb0407412e089382900e3fc4560eea3a938 (patch) | |
tree | 3900be9dae9cfc4f4920edaaa0ea9f54471c3cf4 /test/sequential/test-inspector-contexts.js | |
parent | 7dc35e937d6b3cf57e6184dfc3d54633e5b69082 (diff) | |
download | node-new-f526deb0407412e089382900e3fc4560eea3a938.tar.gz |
src: inspector context name = program title + pid
Report (for example) "node[1337]" as the human-readable name rather
than the more generic and less helpful "Node.js Main Context."
While not perfect yet, it should be an improvement to people that
debug multiple processes from DevTools, VS Code, etc.
PR-URL: https://github.com/nodejs/node/pull/17087
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'test/sequential/test-inspector-contexts.js')
-rw-r--r-- | test/sequential/test-inspector-contexts.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/test/sequential/test-inspector-contexts.js b/test/sequential/test-inspector-contexts.js index 54acfab0d5..c7db962f2a 100644 --- a/test/sequential/test-inspector-contexts.js +++ b/test/sequential/test-inspector-contexts.js @@ -23,9 +23,18 @@ async function testContextCreatedAndDestroyed() { session.post('Runtime.enable'); let contextCreated = await mainContextPromise; - strictEqual('Node.js Main Context', - contextCreated.params.context.name, - JSON.stringify(contextCreated)); + { + const { name } = contextCreated.params.context; + if (common.isSunOS || common.isWindows) { + // uv_get_process_title() is unimplemented on Solaris-likes, it returns + // an empy string. On the Windows CI buildbots it returns "Administrator: + // Windows PowerShell[42]" because of a GetConsoleTitle() quirk. Not much + // we can do about either, just verify that it contains the PID. + strictEqual(name.includes(`[${process.pid}]`), true); + } else { + strictEqual(`${process.argv0}[${process.pid}]`, name); + } + } const secondContextCreatedPromise = notificationPromise('Runtime.executionContextCreated'); |