xref: /third_party/node/test/node-api/test_callback_scope/test.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/node-api/test_callback_scope/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst { runInCallbackScope } = require(`./build/${common.buildType}/binding`);
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciassert.strictEqual(runInCallbackScope({}, 'test-resource', () => 42), 42);
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci{
101cb0ef41Sopenharmony_ci  process.once('uncaughtException', common.mustCall((err) => {
111cb0ef41Sopenharmony_ci    assert.strictEqual(err.message, 'foo');
121cb0ef41Sopenharmony_ci  }));
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci  runInCallbackScope({}, 'test-resource', () => {
151cb0ef41Sopenharmony_ci    throw new Error('foo');
161cb0ef41Sopenharmony_ci  });
171cb0ef41Sopenharmony_ci}
18

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