factorio-test-cli 3.5.0 → 3.5.1
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/config/test-config.js +1 -1
- package/package.json +1 -1
- package/run.js +20 -11
package/config/test-config.js
CHANGED
|
@@ -49,7 +49,7 @@ const testConfigFields = {
|
|
|
49
49
|
schema: z.boolean().optional(),
|
|
50
50
|
cli: {
|
|
51
51
|
flags: "--reorder-failed-first",
|
|
52
|
-
description: "Run previously failed tests first (default:
|
|
52
|
+
description: "Run previously failed tests first (default: disabled).",
|
|
53
53
|
negatable: true,
|
|
54
54
|
},
|
|
55
55
|
},
|
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -5,8 +5,7 @@ import * as fsp from "fs/promises";
|
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import { CliError } from "./cli-error.js";
|
|
7
7
|
import { registerAllCliOptions, resolveConfig } from "./config/index.js";
|
|
8
|
-
import { autoDetectFactorioPath } from "./factorio-process.js";
|
|
9
|
-
import { getHeadlessSavePath, runFactorioTestsGraphics, runFactorioTestsHeadless, } from "./factorio-process.js";
|
|
8
|
+
import { autoDetectFactorioPath, getHeadlessSavePath, runFactorioTestsGraphics, runFactorioTestsHeadless, } from "./factorio-process.js";
|
|
10
9
|
import { watchDirectory, watchFile } from "./file-watcher.js";
|
|
11
10
|
import { configureModToTest, ensureConfigIni, ensureModSettingsDat, installFactorioTest, installModDependencies, installMods, parseModRequirement, resetAutorunSettings, resolveModWatchTarget, setSettingsForAutorun, } from "./mod-setup.js";
|
|
12
11
|
import { runScript, setVerbose } from "./process-utils.js";
|
|
@@ -16,17 +15,27 @@ const thisCommand = program
|
|
|
16
15
|
.command("run")
|
|
17
16
|
.summary("Runs tests with Factorio test.")
|
|
18
17
|
.description(`Runs tests for the specified mod with Factorio test. Exits with code 0 only if all tests pass.
|
|
19
|
-
|
|
20
18
|
One of --mod-path or --mod-name is required.
|
|
21
|
-
Test execution options (--test-pattern, --tag-*, --bail, etc.) override in-mod config.
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
JSON configuration:
|
|
21
|
+
Instead of using command-line arguments, you can configure the test runner using a JSON file.
|
|
22
|
+
By default, the CLI will look for a factorio-test.json file or a "factorio-test" key in
|
|
23
|
+
package.json. You can specify a custom file using the --config option.
|
|
24
|
+
CLI arguments override file config.
|
|
25
|
+
Test execution options (options that can also be specified in the mod itself) go under the
|
|
26
|
+
"test" key using snake_case, overriding in-mod config.
|
|
27
|
+
{
|
|
28
|
+
"modPath": "./my-mod",
|
|
29
|
+
"test": { "bail": 1, "game_speed": 100, "tag_blacklist": ["slow"] }
|
|
30
|
+
}
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
Test filter patterns:
|
|
33
|
+
Filter patterns use Lua pattern syntax (not regex). Special characters like -
|
|
34
|
+
must be escaped with %:
|
|
35
|
+
factorio-test run -p ./my-mod "foo > my%-test"
|
|
36
|
+
When using variadic options (--mods, --factorio-args, etc.) with filter
|
|
37
|
+
patterns, use -- to separate them:
|
|
38
|
+
factorio-test run -p ./my-mod --mods quality space-age -- "inventory"
|
|
30
39
|
|
|
31
40
|
Examples:
|
|
32
41
|
factorio-test run -p ./my-mod Run all tests
|
|
@@ -85,7 +94,7 @@ async function setupTestRun(patterns, cliOptions) {
|
|
|
85
94
|
async function executeTestRun(ctx, execOptions) {
|
|
86
95
|
const { config, factorioPath, dataDir, modsDir, modToTest, mode, savePath, factorioArgs } = ctx;
|
|
87
96
|
const { signal, skipResetAutorun, resolveOnResult } = execOptions ?? {};
|
|
88
|
-
const reorderEnabled = config.testConfig.reorder_failed_first ??
|
|
97
|
+
const reorderEnabled = config.testConfig.reorder_failed_first ?? false;
|
|
89
98
|
const lastFailedTests = reorderEnabled && config.outputFile ? await readPreviousFailedTests(config.outputFile) : [];
|
|
90
99
|
await setSettingsForAutorun(factorioPath, dataDir, modsDir, modToTest, mode, {
|
|
91
100
|
verbose: config.verbose,
|