form-tester 0.3.4 → 0.3.5
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/form-tester.js +17 -14
- package/package.json +1 -1
package/form-tester.js
CHANGED
|
@@ -6,7 +6,7 @@ const { spawn, execSync } = require("child_process");
|
|
|
6
6
|
|
|
7
7
|
const CONFIG_PATH = path.join(__dirname, "form-tester.config.json");
|
|
8
8
|
const OUTPUT_BASE = path.resolve(__dirname, "output");
|
|
9
|
-
const LOCAL_VERSION = "0.3.
|
|
9
|
+
const LOCAL_VERSION = "0.3.5";
|
|
10
10
|
const RECOMMENDED_PERSON = "Uromantisk Direktør";
|
|
11
11
|
|
|
12
12
|
const PERSONAS = [
|
|
@@ -272,7 +272,11 @@ function isPlaywrightCliAvailable() {
|
|
|
272
272
|
|
|
273
273
|
function runCommand(command, args, options = {}) {
|
|
274
274
|
return new Promise((resolve) => {
|
|
275
|
-
const child = spawn(command, args, {
|
|
275
|
+
const child = spawn(command, args, {
|
|
276
|
+
stdio: "inherit",
|
|
277
|
+
shell: process.platform === "win32",
|
|
278
|
+
...options,
|
|
279
|
+
});
|
|
276
280
|
child.on("error", (err) => {
|
|
277
281
|
console.error(`Failed to launch ${command}: ${err.message}`);
|
|
278
282
|
resolve(1);
|
|
@@ -284,9 +288,9 @@ function runCommand(command, args, options = {}) {
|
|
|
284
288
|
function runPlaywrightCli(args) {
|
|
285
289
|
return new Promise((resolve) => {
|
|
286
290
|
const spec = getPlaywrightCommandSpec();
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
291
|
+
const spawnOpts = { stdio: "inherit" };
|
|
292
|
+
if (spec.shell) spawnOpts.shell = true;
|
|
293
|
+
const child = spawn(spec.command, [...spec.args, ...args], spawnOpts);
|
|
290
294
|
child.on("error", (err) => {
|
|
291
295
|
console.error(`Failed to launch ${spec.command}: ${err.message}`);
|
|
292
296
|
resolve(1);
|
|
@@ -298,10 +302,12 @@ function runPlaywrightCli(args) {
|
|
|
298
302
|
function runPlaywrightCliCapture(args) {
|
|
299
303
|
return new Promise((resolve) => {
|
|
300
304
|
const spec = getPlaywrightCommandSpec();
|
|
305
|
+
const captureOpts = { stdio: ["ignore", "pipe", "pipe"] };
|
|
306
|
+
if (spec.shell) captureOpts.shell = true;
|
|
301
307
|
const child = spawn(
|
|
302
308
|
spec.command,
|
|
303
309
|
[...spec.args, ...args],
|
|
304
|
-
|
|
310
|
+
captureOpts,
|
|
305
311
|
);
|
|
306
312
|
let stdout = "";
|
|
307
313
|
let stderr = "";
|
|
@@ -328,6 +334,7 @@ function getPlaywrightCommandSpec() {
|
|
|
328
334
|
const command = getPlaywrightCommand();
|
|
329
335
|
const lower = command.toLowerCase();
|
|
330
336
|
if (process.platform === "win32" && (lower.endsWith(".cmd") || lower.endsWith(".ps1"))) {
|
|
337
|
+
// Try to resolve the actual .js entry point to avoid shell/spawn issues
|
|
331
338
|
const nodeDir = path.dirname(command);
|
|
332
339
|
const cliPath = path.join(
|
|
333
340
|
nodeDir,
|
|
@@ -337,16 +344,12 @@ function getPlaywrightCommandSpec() {
|
|
|
337
344
|
"playwright-cli.js",
|
|
338
345
|
);
|
|
339
346
|
if (fs.existsSync(cliPath)) {
|
|
340
|
-
return { command: process.execPath, args: [cliPath] };
|
|
347
|
+
return { command: process.execPath, args: [cliPath], shell: false };
|
|
341
348
|
}
|
|
349
|
+
// Fallback: run via node process.execPath with the .cmd/.ps1 content
|
|
350
|
+
return { command, args: [], shell: true };
|
|
342
351
|
}
|
|
343
|
-
|
|
344
|
-
return {
|
|
345
|
-
command: "powershell",
|
|
346
|
-
args: ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", command],
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
return { command, args: [] };
|
|
352
|
+
return { command, args: [], shell: false };
|
|
350
353
|
}
|
|
351
354
|
|
|
352
355
|
function findRepoRoot(startDir) {
|
package/package.json
CHANGED