summaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-console-listeners.js
blob: 9f0d6e4824ed7ebadc0a18f166e2c376080c85a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';
const common = require('../common');
const { Worker, isMainThread } = require('worker_threads');
const EventEmitter = require('events');

if (isMainThread) {
  process.on('warning', common.mustNotCall('unexpected warning'));

  for (let i = 0; i < EventEmitter.defaultMaxListeners; ++i) {
    const worker = new Worker(__filename);

    worker.on('exit', common.mustCall(() => {
      console.log('a'); // This console.log() is part of the test.
    }));
  }
}