From 52012e321bab438e96191fc90203fbb6cea6c7a7 Mon Sep 17 00:00:00 2001 From: VariableVince <24507472+VariableVince@users.noreply.github.com> Date: Mon, 16 Feb 2026 20:25:54 +0100 Subject: [PATCH] Fix: npm run perf errors on Windows (#3192) ## Description: Npm script 'perf' errors on Windows: "Error [ERR_MODULE_NOT_FOUND]: Cannot find module '(XXX)\OpenFrontIO\tests\perf\*.ts'". It probably worked fine on Linux or Mac, that i don't know. Replaced it with a file that also runs all tests in the folder, which is then simply ran by the script. There are possibly better ways to address this but this just works. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: tryout33 --- package.json | 2 +- tests/perf/run-all.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/perf/run-all.ts diff --git a/package.json b/package.json index b99fe1fef..2903e3ce0 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "docs:map-generator": "cd map-generator && go doc -cmd -u -all", "tunnel": "npm run build-prod && npm run start:server", "test": "vitest run && vitest run tests/server", - "perf": "npx tsx tests/perf/*.ts", + "perf": "npx tsx tests/perf/run-all.ts", "test:coverage": "vitest run --coverage", "format": "prettier --ignore-unknown --write .", "format:map-generator": "cd map-generator && go fmt .", diff --git a/tests/perf/run-all.ts b/tests/perf/run-all.ts new file mode 100644 index 000000000..be84c1971 --- /dev/null +++ b/tests/perf/run-all.ts @@ -0,0 +1,9 @@ +import { execSync } from "child_process"; +import { globSync } from "glob"; + +// "perf": "npx tsx tests/perf/*.ts" doesn't work on Windows +const files = globSync("tests/perf/*.ts").filter((f) => !f.includes("run-all")); +for (const file of files) { + console.log(`\nRunning ${file}...`); + execSync(`tsx "${file}"`, { stdio: "inherit" }); +}