xref: /third_party/node/test/async-hooks/test-enable-in-init.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/async-hooks/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst async_hooks = require('async_hooks');
51cb0ef41Sopenharmony_ciconst fs = require('fs');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst nestedHook = async_hooks.createHook({
81cb0ef41Sopenharmony_ci  init: common.mustNotCall(),
91cb0ef41Sopenharmony_ci});
101cb0ef41Sopenharmony_cilet nestedCall = false;
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciasync_hooks.createHook({
131cb0ef41Sopenharmony_ci  init: common.mustCall(() => {
141cb0ef41Sopenharmony_ci    nestedHook.enable();
151cb0ef41Sopenharmony_ci    if (!nestedCall) {
161cb0ef41Sopenharmony_ci      nestedCall = true;
171cb0ef41Sopenharmony_ci      fs.access(__filename, common.mustCall());
181cb0ef41Sopenharmony_ci    }
191cb0ef41Sopenharmony_ci  }, 2),
201cb0ef41Sopenharmony_ci}).enable();
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_cifs.access(__filename, common.mustCall());
23

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