mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: add extended embedder cctest
Add an embedder cctest that also covers a multi-Environment situation, including worker_threads-style inspector support. Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com> Backport-PR-URL: https://github.com/nodejs/node/pull/35241 PR-URL: https://github.com/nodejs/node/pull/30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
1 parent
1a7082052f
commit
cb635c2dc0
6 files changed
+180
-41
No files matched your search
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const fixtures = require('../common/fixtures');
|
||||
const assert = require('assert');
|
||||
const child_process = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
common.allowGlobals(global.require);
|
||||
let binary = process.features.debug ?
|
||||
'out/Debug/embedtest' : 'out/Release/embedtest';
|
||||
if (common.isWindows) {
|
||||
binary += '.exe';
|
||||
}
|
||||
binary = path.resolve(__dirname, '..', '..', binary);
|
||||
|
||||
assert.strictEqual(
|
||||
child_process.spawnSync(binary, ['console.log(42)'])
|
||||
.stdout.toString().trim(),
|
||||
'42');
|
||||
|
||||
assert.strictEqual(
|
||||
child_process.spawnSync(binary, ['throw new Error()']).status,
|
||||
1);
|
||||
|
||||
assert.strictEqual(
|
||||
child_process.spawnSync(binary, ['process.exitCode = 8']).status,
|
||||
8);
|
||||
|
||||
|
||||
const fixturePath = JSON.stringify(fixtures.path('exit.js'));
|
||||
assert.strictEqual(
|
||||
child_process.spawnSync(binary, [`require(${fixturePath})`, 92]).status,
|
||||
92);
|
||||
@@ -1,19 +0,0 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const child_process = require('child_process');
|
||||
|
||||
common.allowGlobals(global.require);
|
||||
|
||||
assert.strictEqual(
|
||||
child_process.spawnSync(process.execPath, ['console.log(42)'])
|
||||
.stdout.toString().trim(),
|
||||
'42');
|
||||
|
||||
assert.strictEqual(
|
||||
child_process.spawnSync(process.execPath, ['throw new Error()']).status,
|
||||
1);
|
||||
|
||||
assert.strictEqual(
|
||||
child_process.spawnSync(process.execPath, ['process.exitCode = 8']).status,
|
||||
8);
|
||||
@@ -0,0 +1,6 @@
|
||||
import sys, os
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import testpy
|
||||
|
||||
def GetConfiguration(context, root):
|
||||
return testpy.SimpleTestConfiguration(context, root, 'embedding')
|
||||
Reference in new issue
Block a user