Add NO_EXTERNAL_TEST flag to skip tests using external APIs

Adds an externalTest(this) helper alongside slowTest that skips the test
when NO_EXTERNAL_TEST is set and raises the timeout to 60s, plus a
no-external-test script. Marks the tests hitting factorio.com, the mod
portal and GitHub with it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Fable 5 committed 2026-08-18 19:55:18 +00:00
1 parent 0be4fd77e5
commit 0cfa048d42
8 files changed
+34 -6

No files matched your search

+14
View File
@@ -128,6 +128,15 @@ function slowTest(test) {
test.timeout(30000);
}
// Mark that this test depends on an external API and may be slow or flaky.
function externalTest(test) {
if (process.env.NO_EXTERNAL_TEST) {
test.skip();
}
test.timeout(60000);
}
// Mark that this test or suite of tests requires a factorio install to run.
function requiresFactorio(testOrSuite) {
if (testOrSuite.skip) {
@@ -320,6 +329,10 @@ before(async function() {
console.log("FAST_TEST is present in env, slow tests will be skipped.");
}
if (process.env.NO_EXTERNAL_TEST) {
console.log("NO_EXTERNAL_TEST is present in env, tests depending on external APIs will be skipped.");
}
await fs.rm(instancesDir, { force: true, recursive: true, maxRetries: 10 });
await fs.rm(modsDir, { force: true, recursive: true, maxRetries: 10 });
await fs.rm(databaseDir, { force: true, recursive: true, maxRetries: 10 });
@@ -433,6 +446,7 @@ module.exports = {
execController,
execCtlProcess,
slowTest,
externalTest,
requiresFactorio,
get,
exec,