xref: /third_party/node/test/node-api/test_cleanup_hook/test.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/node-api/test_cleanup_hook/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst child_process = require('child_process');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciif (process.argv[2] === 'child') {
71cb0ef41Sopenharmony_ci  require(`./build/${common.buildType}/binding`);
81cb0ef41Sopenharmony_ci} else {
91cb0ef41Sopenharmony_ci  const { stdout, status, signal } =
101cb0ef41Sopenharmony_ci    child_process.spawnSync(process.execPath, [__filename, 'child']);
111cb0ef41Sopenharmony_ci  assert.strictEqual(status, 0, `process exited with status(${status}) and signal(${signal})`);
121cb0ef41Sopenharmony_ci  assert.strictEqual(stdout.toString().trim(), 'cleanup(42)');
131cb0ef41Sopenharmony_ci}
14

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