11cb0ef41Sopenharmony_ci// Tab completion sometimes uses a separate REPL instance under the hood.
21cb0ef41Sopenharmony_ci// That REPL instance has its own domain. Make sure domain errors trickle back
31cb0ef41Sopenharmony_ci// up to the main REPL.
41cb0ef41Sopenharmony_ci//
51cb0ef41Sopenharmony_ci// Ref: https://github.com/nodejs/node/issues/21586
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci'use strict';
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_cirequire('../common');
101cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst assert = require('assert');
131cb0ef41Sopenharmony_ciconst { spawnSync } = require('child_process');
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciconst testFile = fixtures.path('repl-tab-completion-nested-repls.js');
161cb0ef41Sopenharmony_ciconst result = spawnSync(process.execPath, [testFile]);
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci// The spawned process will fail. In Node.js 10.11.0, it will fail silently. The
191cb0ef41Sopenharmony_ci// test here is to make sure that the error information bubbles up to the
201cb0ef41Sopenharmony_ci// calling process.
211cb0ef41Sopenharmony_ciassert.ok(result.status, 'testFile swallowed its error');
221cb0ef41Sopenharmony_ciconst err = result.stderr.toString();
231cb0ef41Sopenharmony_ciassert.ok(err.includes('fhqwhgads'), err);
24