Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/mocha-without-npx.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Run Mocha in the test scripts without npx, which failed on Windows with Node 26.14.0.
9 changes: 6 additions & 3 deletions lib_dev/process.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as child_process from "node:child_process";
import * as fs from "node:fs/promises";
import { createRequire } from "node:module";
import * as path from "node:path";
import { bsc_exe, rescript_exe } from "#cli/bins";

Expand All @@ -15,6 +16,8 @@ import { bsc_exe, rescript_exe } from "#cli/bins";
* }} ExecResult
*/

const mochaBin = createRequire(import.meta.url).resolve("mocha/bin/mocha.js");

const signals = {
SIGINT: 2,
SIGQUIT: 3,
Expand Down Expand Up @@ -126,9 +129,9 @@ export function setup(cwd = process.cwd()) {
* @return {Promise<ExecResult>}
*/
mocha(args = [], options = {}) {
// `yarn mocha` works, but format output differently
// No more efforts here since we're plannig to drop Mocha
return exec("npx", ["mocha", ...args], options);
// Run Mocha's CLI script with Node directly. On Windows, `npx mocha`
// failed with Node 26.14.0 to find the script it should run.
return exec("node", [mochaBin, ...args], options);
},

/**
Expand Down
Loading