@midscene/cli 1.13.1-beta-20260921080849.0 → 1.13.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/dist/es/framework/index.mjs +31 -26
- package/dist/es/framework/index.mjs.map +1 -1
- package/dist/es/index.mjs +35 -28
- package/dist/es/index.mjs.map +1 -1
- package/dist/lib/framework/index.js +31 -26
- package/dist/lib/framework/index.js.map +1 -1
- package/dist/lib/index.js +35 -28
- package/dist/lib/index.js.map +1 -1
- package/package.json +10 -10
package/dist/es/index.mjs
CHANGED
|
@@ -19,6 +19,7 @@ import puppeteer from "puppeteer";
|
|
|
19
19
|
import { createYamlPlayer as yaml_runtime_createYamlPlayer } from "@midscene/test/internal/yaml-runtime";
|
|
20
20
|
import { stripVTControlCharacters } from "node:util";
|
|
21
21
|
import { createRequire } from "node:module";
|
|
22
|
+
import { serializeError } from "@midscene/shared/agent-tools/error-formatter";
|
|
22
23
|
import { globalModelConfigManager } from "@midscene/shared/env";
|
|
23
24
|
import { classifyWorkflowDocumentFormat } from "@midscene/core/internal/test-runner";
|
|
24
25
|
import * as __rspack_external_assert from "assert";
|
|
@@ -3022,7 +3023,9 @@ var __webpack_modules__ = {
|
|
|
3022
3023
|
module.exports = (string, columns, options)=>String(string).normalize().replace(/\r\n/g, '\n').split('\n').map((line)=>exec(line, columns, options)).join('\n');
|
|
3023
3024
|
},
|
|
3024
3025
|
"./src/index.ts" (__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
3025
|
-
var package_namespaceObject =
|
|
3026
|
+
var package_namespaceObject = {
|
|
3027
|
+
rE: "1.13.1"
|
|
3028
|
+
};
|
|
3026
3029
|
var brace_expansion = __webpack_require__("../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js");
|
|
3027
3030
|
const MAX_PATTERN_LENGTH = 65536;
|
|
3028
3031
|
const assertValidPattern = (pattern)=>{
|
|
@@ -8693,7 +8696,7 @@ Usage:
|
|
|
8693
8696
|
type: 'boolean',
|
|
8694
8697
|
description: 'Whether to dismiss the HarmonyOS keyboard after text input'
|
|
8695
8698
|
}
|
|
8696
|
-
}).version('version', 'Show version number', "1.13.1
|
|
8699
|
+
}).version('version', 'Show version number', "1.13.1").help().epilogue(`For complete list of configuration options, please visit:
|
|
8697
8700
|
• Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
|
|
8698
8701
|
• Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
|
|
8699
8702
|
• HarmonyOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-harmony-part
|
|
@@ -12528,27 +12531,23 @@ defineYamlBatchTest(test, testOptions);
|
|
|
12528
12531
|
}
|
|
12529
12532
|
});
|
|
12530
12533
|
const rstest_contract_RSTEST_YAML_CASE_IDS_META_KEY = 'midsceneYamlCaseIds';
|
|
12531
|
-
const formatRunError = (error)=>error.stack || `${error.name}: ${error.message}`;
|
|
12534
|
+
const formatRunError = (error)=>error.stack || `${error.name || 'Error'}: ${error.message}`;
|
|
12532
12535
|
const collectRunErrors = (result)=>{
|
|
12533
12536
|
const messages = [];
|
|
12534
12537
|
const push = (error, label)=>{
|
|
12535
12538
|
const formatted = formatRunError(error);
|
|
12536
12539
|
messages.push(label ? `${label}: ${formatted}` : formatted);
|
|
12537
12540
|
};
|
|
12538
|
-
for (const file of result.
|
|
12541
|
+
for (const file of result.results){
|
|
12539
12542
|
for (const error of file.errors ?? [])push(error, file.name || file.testPath);
|
|
12540
12543
|
for (const testResult of file.results ?? [])for (const error of testResult.errors ?? [])push(error, testResult.name);
|
|
12541
12544
|
}
|
|
12542
|
-
for (const error of result.unhandledErrors
|
|
12545
|
+
for (const error of result.unhandledErrors)push(error);
|
|
12543
12546
|
return Array.from(new Set(messages));
|
|
12544
12547
|
};
|
|
12545
12548
|
const rstest_runner_errorMessage = (error)=>error.message || error.name || 'YAML case failed';
|
|
12546
12549
|
const mapRunErrorsToCases = (project, result)=>{
|
|
12547
|
-
const
|
|
12548
|
-
item.caseId,
|
|
12549
|
-
item
|
|
12550
|
-
]));
|
|
12551
|
-
const knownCaseIds = new Set(casesById.keys());
|
|
12550
|
+
const knownCaseIds = new Set(project.cases.map((item)=>item.caseId));
|
|
12552
12551
|
const errors = new Map();
|
|
12553
12552
|
const add = (caseId, message)=>{
|
|
12554
12553
|
if (knownCaseIds.has(caseId) && message && !errors.has(caseId)) errors.set(caseId, message);
|
|
@@ -12571,7 +12570,7 @@ defineYamlBatchTest(test, testOptions);
|
|
|
12571
12570
|
const value = testResult.meta?.[rstest_contract_RSTEST_YAML_CASE_IDS_META_KEY];
|
|
12572
12571
|
return Array.isArray(value) ? value.filter((item)=>'string' == typeof item) : [];
|
|
12573
12572
|
};
|
|
12574
|
-
for (const file of result.
|
|
12573
|
+
for (const file of result.results){
|
|
12575
12574
|
const moduleCaseIds = findModuleCaseIds(file);
|
|
12576
12575
|
for (const error of file.errors ?? [])addCases(moduleCaseIds, rstest_runner_errorMessage(error));
|
|
12577
12576
|
for (const testResult of file.results ?? []){
|
|
@@ -12579,18 +12578,13 @@ defineYamlBatchTest(test, testOptions);
|
|
|
12579
12578
|
for (const error of testResult.errors ?? [])addCases(caseIds.length ? caseIds : moduleCaseIds, rstest_runner_errorMessage(error));
|
|
12580
12579
|
}
|
|
12581
12580
|
}
|
|
12582
|
-
if (
|
|
12581
|
+
if (result.unhandledErrors.length) {
|
|
12583
12582
|
const message = rstest_runner_errorMessage(result.unhandledErrors[0]);
|
|
12584
|
-
for (const
|
|
12585
|
-
const item = casesById.get(caseId);
|
|
12586
|
-
if (!errors.has(caseId) || item && !(0, __rspack_external_node_fs_5ea92f0c.existsSync)(item.resultFile)) errors.set(caseId, message);
|
|
12587
|
-
}
|
|
12583
|
+
for (const item of project.cases)if (!errors.has(item.caseId) && !(0, __rspack_external_node_fs_5ea92f0c.existsSync)(item.resultFile)) errors.set(item.caseId, message);
|
|
12588
12584
|
}
|
|
12589
12585
|
return errors;
|
|
12590
12586
|
};
|
|
12591
|
-
const
|
|
12592
|
-
if (!project.cases.length) return;
|
|
12593
|
-
const caseErrors = mapRunErrorsToCases(project, result);
|
|
12587
|
+
const writePendingCaseFailures = (project, caseErrors)=>{
|
|
12594
12588
|
for (const item of project.cases){
|
|
12595
12589
|
if ((0, __rspack_external_node_fs_5ea92f0c.existsSync)(item.resultFile)) continue;
|
|
12596
12590
|
const error = caseErrors.get(item.caseId);
|
|
@@ -12612,13 +12606,13 @@ defineYamlBatchTest(test, testOptions);
|
|
|
12612
12606
|
}
|
|
12613
12607
|
};
|
|
12614
12608
|
async function runRstestYamlProject(options) {
|
|
12615
|
-
const [{
|
|
12609
|
+
const [{ createRstest }, { rspack }] = await Promise.all([
|
|
12616
12610
|
import("@rstest/core/api"),
|
|
12617
12611
|
import(pathToFileURL(resolvePackageFromRstestCore('@rsbuild/core')).href)
|
|
12618
12612
|
]);
|
|
12619
12613
|
const { project } = options;
|
|
12620
12614
|
const maxConcurrency = void 0 !== project.maxConcurrency ? Math.max(1, project.maxConcurrency) : void 0;
|
|
12621
|
-
const
|
|
12615
|
+
const config = {
|
|
12622
12616
|
root: project.projectDir,
|
|
12623
12617
|
include: project.modules.map((item)=>item.id),
|
|
12624
12618
|
testEnvironment: 'node',
|
|
@@ -12649,18 +12643,31 @@ defineYamlBatchTest(test, testOptions);
|
|
|
12649
12643
|
}
|
|
12650
12644
|
}
|
|
12651
12645
|
};
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12646
|
+
let result;
|
|
12647
|
+
try {
|
|
12648
|
+
const rstest = await createRstest({
|
|
12649
|
+
cwd: options.cwd || project.projectDir,
|
|
12650
|
+
config
|
|
12651
|
+
});
|
|
12652
|
+
result = await rstest.run();
|
|
12653
|
+
} catch (error) {
|
|
12654
|
+
const serialized = serializeError(error);
|
|
12655
|
+
writePendingCaseFailures(project, new Map(project.cases.map((item)=>[
|
|
12656
|
+
item.caseId,
|
|
12657
|
+
serialized.message
|
|
12658
|
+
])));
|
|
12659
|
+
if ('pipe' !== options.stdio) console.error(`\nYAML execution failed:\n${formatRunError(serialized)}`);
|
|
12660
|
+
return 1;
|
|
12661
|
+
}
|
|
12662
|
+
const ok = 'pass' === result.status;
|
|
12663
|
+
if (!ok) {
|
|
12664
|
+
writePendingCaseFailures(project, mapRunErrorsToCases(project, result));
|
|
12658
12665
|
if ('pipe' !== options.stdio) {
|
|
12659
12666
|
const runErrors = collectRunErrors(result);
|
|
12660
12667
|
if (runErrors.length) console.error(`\nYAML execution failed:\n${runErrors.join('\n\n')}`);
|
|
12661
12668
|
}
|
|
12662
12669
|
}
|
|
12663
|
-
return
|
|
12670
|
+
return ok ? 0 : 1;
|
|
12664
12671
|
}
|
|
12665
12672
|
const defaultInProcessRunner = (config)=>new BatchRunner(config).run();
|
|
12666
12673
|
async function runConfigInMainProcess(config, commandOptions) {
|