@jsenv/test 3.5.2 → 3.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jsenv_test.js
CHANGED
|
@@ -5464,15 +5464,15 @@ const pingServer = async (url) => {
|
|
|
5464
5464
|
|
|
5465
5465
|
const startServerUsingCommand = async (
|
|
5466
5466
|
webServer,
|
|
5467
|
-
{ signal, allocatedMs, logger, teardownCallbackSet },
|
|
5467
|
+
{ args = [], signal, allocatedMs, logger, teardownCallbackSet, shell = true },
|
|
5468
5468
|
) => {
|
|
5469
|
-
const spawnedProcess = spawn(webServer.command,
|
|
5469
|
+
const spawnedProcess = spawn(webServer.command, args, {
|
|
5470
5470
|
// On non-windows platforms, `detached: true` makes child process a leader of a new
|
|
5471
5471
|
// process group, making it possible to kill child process tree with `.kill(-pid)` command.
|
|
5472
5472
|
// @see https://nodejs.org/api/child_process.html#child_process_options_detached
|
|
5473
5473
|
detached: process.platform !== "win32",
|
|
5474
5474
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5475
|
-
shell
|
|
5475
|
+
shell,
|
|
5476
5476
|
cwd: webServer.cwd,
|
|
5477
5477
|
});
|
|
5478
5478
|
if (!spawnedProcess.pid) {
|
|
@@ -5502,6 +5502,10 @@ const startServerUsingCommand = async (
|
|
|
5502
5502
|
let isAbort = false;
|
|
5503
5503
|
let isTeardown = false;
|
|
5504
5504
|
let processClosed = false;
|
|
5505
|
+
let stderr = "";
|
|
5506
|
+
spawnedProcess.stderr.on("data", (data) => {
|
|
5507
|
+
stderr += String(data);
|
|
5508
|
+
});
|
|
5505
5509
|
const closedPromise = new Promise((resolve) => {
|
|
5506
5510
|
spawnedProcess.once("exit", (exitCode, signal) => {
|
|
5507
5511
|
processClosed = true;
|
|
@@ -5511,7 +5515,10 @@ const startServerUsingCommand = async (
|
|
|
5511
5515
|
);
|
|
5512
5516
|
} else {
|
|
5513
5517
|
logger.error(
|
|
5514
|
-
`web server process premature exit exitCode=${exitCode}, exitSignal=${signal}, pid=${spawnedProcess.pid}
|
|
5518
|
+
`web server process premature exit exitCode=${exitCode}, exitSignal=${signal}, pid=${spawnedProcess.pid}
|
|
5519
|
+
--- stderr ---
|
|
5520
|
+
${stderr}
|
|
5521
|
+
--------------`,
|
|
5515
5522
|
);
|
|
5516
5523
|
}
|
|
5517
5524
|
resolve();
|
|
@@ -5613,6 +5620,7 @@ const startServerUsingModuleUrl = async (webServer, params) => {
|
|
|
5613
5620
|
{
|
|
5614
5621
|
...webServer,
|
|
5615
5622
|
command: `node ${fileURLToPath(webServer.moduleUrl)}`,
|
|
5623
|
+
args: ["--jsenv-test"],
|
|
5616
5624
|
},
|
|
5617
5625
|
params,
|
|
5618
5626
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@jsenv/abort": "4.3.0",
|
|
40
40
|
"@jsenv/ast": "6.2.17",
|
|
41
41
|
"@jsenv/exception": "1.1.3",
|
|
42
|
-
"@jsenv/filesystem": "4.10.
|
|
42
|
+
"@jsenv/filesystem": "4.10.4",
|
|
43
43
|
"@jsenv/github-check-run": "0.2.1",
|
|
44
44
|
"@jsenv/node-esm-resolution": "1.0.6",
|
|
45
45
|
"@jsenv/humanize": "1.2.8",
|
|
@@ -4,15 +4,15 @@ import { pingServer } from "../../helpers/ping_server.js";
|
|
|
4
4
|
|
|
5
5
|
export const startServerUsingCommand = async (
|
|
6
6
|
webServer,
|
|
7
|
-
{ signal, allocatedMs, logger, teardownCallbackSet },
|
|
7
|
+
{ args = [], signal, allocatedMs, logger, teardownCallbackSet, shell = true },
|
|
8
8
|
) => {
|
|
9
|
-
const spawnedProcess = spawn(webServer.command,
|
|
9
|
+
const spawnedProcess = spawn(webServer.command, args, {
|
|
10
10
|
// On non-windows platforms, `detached: true` makes child process a leader of a new
|
|
11
11
|
// process group, making it possible to kill child process tree with `.kill(-pid)` command.
|
|
12
12
|
// @see https://nodejs.org/api/child_process.html#child_process_options_detached
|
|
13
13
|
detached: process.platform !== "win32",
|
|
14
14
|
stdio: ["pipe", "pipe", "pipe"],
|
|
15
|
-
shell
|
|
15
|
+
shell,
|
|
16
16
|
cwd: webServer.cwd,
|
|
17
17
|
});
|
|
18
18
|
if (!spawnedProcess.pid) {
|
|
@@ -42,6 +42,10 @@ export const startServerUsingCommand = async (
|
|
|
42
42
|
let isAbort = false;
|
|
43
43
|
let isTeardown = false;
|
|
44
44
|
let processClosed = false;
|
|
45
|
+
let stderr = "";
|
|
46
|
+
spawnedProcess.stderr.on("data", (data) => {
|
|
47
|
+
stderr += String(data);
|
|
48
|
+
});
|
|
45
49
|
const closedPromise = new Promise((resolve) => {
|
|
46
50
|
spawnedProcess.once("exit", (exitCode, signal) => {
|
|
47
51
|
processClosed = true;
|
|
@@ -51,7 +55,10 @@ export const startServerUsingCommand = async (
|
|
|
51
55
|
);
|
|
52
56
|
} else {
|
|
53
57
|
logger.error(
|
|
54
|
-
`web server process premature exit exitCode=${exitCode}, exitSignal=${signal}, pid=${spawnedProcess.pid}
|
|
58
|
+
`web server process premature exit exitCode=${exitCode}, exitSignal=${signal}, pid=${spawnedProcess.pid}
|
|
59
|
+
--- stderr ---
|
|
60
|
+
${stderr}
|
|
61
|
+
--------------`,
|
|
55
62
|
);
|
|
56
63
|
}
|
|
57
64
|
resolve();
|