xref: /third_party/node/test/parallel/test-async-hooks-worker-asyncfn-terminate-3.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci// Like test-async-hooks-worker-promise.js but with an additional statement
61cb0ef41Sopenharmony_ci// after the `process.exit()` call, that shouldn’t really make a difference
71cb0ef41Sopenharmony_ci// but apparently does.
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst w = new Worker(`
101cb0ef41Sopenharmony_ciconst { createHook } = require('async_hooks');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_cisetImmediate(async () => {
131cb0ef41Sopenharmony_ci  createHook({ init() {} }).enable();
141cb0ef41Sopenharmony_ci  await 0;
151cb0ef41Sopenharmony_ci  process.exit();
161cb0ef41Sopenharmony_ci  process._rawDebug('THIS SHOULD NEVER BE REACHED');
171cb0ef41Sopenharmony_ci});
181cb0ef41Sopenharmony_ci`, { eval: true });
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciw.on('exit', common.mustCall());
21

Indexes created Thu Nov 07 10:32:03 CST 2024