0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-25 08:19:38 +01:00
nodejs/test/parallel/test-inspector-connect-to-main-thread.js

21 lines
434 B
JavaScript
Raw Permalink Normal View History

'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const { Session } = require('inspector');
const { Worker, isMainThread, workerData } = require('worker_threads');
if (!workerData) {
common.skipIfWorker();
}
if (isMainThread) {
new Worker(__filename, { workerData: {} });
} else {
const session = new Session();
session.connectToMainThread();
// Do not crash
session.disconnect();
}