@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/lib/index.js
CHANGED
|
@@ -4592,29 +4592,26 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4592
4592
|
};
|
|
4593
4593
|
}
|
|
4594
4594
|
var external_node_url_ = __webpack_require__("node:url");
|
|
4595
|
+
const error_formatter_namespaceObject = require("@midscene/shared/agent-tools/error-formatter");
|
|
4595
4596
|
var progress_reporter = __webpack_require__("./src/framework/progress-reporter.ts");
|
|
4596
4597
|
var rstest_contract = __webpack_require__("./src/framework/rstest-contract.ts");
|
|
4597
|
-
const formatRunError = (error)=>error.stack || `${error.name}: ${error.message}`;
|
|
4598
|
+
const formatRunError = (error)=>error.stack || `${error.name || 'Error'}: ${error.message}`;
|
|
4598
4599
|
const collectRunErrors = (result)=>{
|
|
4599
4600
|
const messages = [];
|
|
4600
4601
|
const push = (error, label)=>{
|
|
4601
4602
|
const formatted = formatRunError(error);
|
|
4602
4603
|
messages.push(label ? `${label}: ${formatted}` : formatted);
|
|
4603
4604
|
};
|
|
4604
|
-
for (const file of result.
|
|
4605
|
+
for (const file of result.results){
|
|
4605
4606
|
for (const error of file.errors ?? [])push(error, file.name || file.testPath);
|
|
4606
4607
|
for (const testResult of file.results ?? [])for (const error of testResult.errors ?? [])push(error, testResult.name);
|
|
4607
4608
|
}
|
|
4608
|
-
for (const error of result.unhandledErrors
|
|
4609
|
+
for (const error of result.unhandledErrors)push(error);
|
|
4609
4610
|
return Array.from(new Set(messages));
|
|
4610
4611
|
};
|
|
4611
4612
|
const rstest_runner_errorMessage = (error)=>error.message || error.name || 'YAML case failed';
|
|
4612
4613
|
const mapRunErrorsToCases = (project, result)=>{
|
|
4613
|
-
const
|
|
4614
|
-
item.caseId,
|
|
4615
|
-
item
|
|
4616
|
-
]));
|
|
4617
|
-
const knownCaseIds = new Set(casesById.keys());
|
|
4614
|
+
const knownCaseIds = new Set(project.cases.map((item)=>item.caseId));
|
|
4618
4615
|
const errors = new Map();
|
|
4619
4616
|
const add = (caseId, message)=>{
|
|
4620
4617
|
if (knownCaseIds.has(caseId) && message && !errors.has(caseId)) errors.set(caseId, message);
|
|
@@ -4637,7 +4634,7 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4637
4634
|
const value = testResult.meta?.[rstest_contract.k];
|
|
4638
4635
|
return Array.isArray(value) ? value.filter((item)=>'string' == typeof item) : [];
|
|
4639
4636
|
};
|
|
4640
|
-
for (const file of result.
|
|
4637
|
+
for (const file of result.results){
|
|
4641
4638
|
const moduleCaseIds = findModuleCaseIds(file);
|
|
4642
4639
|
for (const error of file.errors ?? [])addCases(moduleCaseIds, rstest_runner_errorMessage(error));
|
|
4643
4640
|
for (const testResult of file.results ?? []){
|
|
@@ -4645,18 +4642,13 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4645
4642
|
for (const error of testResult.errors ?? [])addCases(caseIds.length ? caseIds : moduleCaseIds, rstest_runner_errorMessage(error));
|
|
4646
4643
|
}
|
|
4647
4644
|
}
|
|
4648
|
-
if (
|
|
4645
|
+
if (result.unhandledErrors.length) {
|
|
4649
4646
|
const message = rstest_runner_errorMessage(result.unhandledErrors[0]);
|
|
4650
|
-
for (const
|
|
4651
|
-
const item = casesById.get(caseId);
|
|
4652
|
-
if (!errors.has(caseId) || item && !(0, external_node_fs_.existsSync)(item.resultFile)) errors.set(caseId, message);
|
|
4653
|
-
}
|
|
4647
|
+
for (const item of project.cases)if (!errors.has(item.caseId) && !(0, external_node_fs_.existsSync)(item.resultFile)) errors.set(item.caseId, message);
|
|
4654
4648
|
}
|
|
4655
4649
|
return errors;
|
|
4656
4650
|
};
|
|
4657
|
-
const
|
|
4658
|
-
if (!project.cases.length) return;
|
|
4659
|
-
const caseErrors = mapRunErrorsToCases(project, result);
|
|
4651
|
+
const writePendingCaseFailures = (project, caseErrors)=>{
|
|
4660
4652
|
for (const item of project.cases){
|
|
4661
4653
|
if ((0, external_node_fs_.existsSync)(item.resultFile)) continue;
|
|
4662
4654
|
const error = caseErrors.get(item.caseId);
|
|
@@ -4678,13 +4670,13 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4678
4670
|
}
|
|
4679
4671
|
};
|
|
4680
4672
|
async function runRstestYamlProject(options) {
|
|
4681
|
-
const [{
|
|
4673
|
+
const [{ createRstest }, { rspack }] = await Promise.all([
|
|
4682
4674
|
import("@rstest/core/api"),
|
|
4683
4675
|
import((0, external_node_url_.pathToFileURL)(resolvePackageFromRstestCore('@rsbuild/core')).href)
|
|
4684
4676
|
]);
|
|
4685
4677
|
const { project } = options;
|
|
4686
4678
|
const maxConcurrency = void 0 !== project.maxConcurrency ? Math.max(1, project.maxConcurrency) : void 0;
|
|
4687
|
-
const
|
|
4679
|
+
const config = {
|
|
4688
4680
|
root: project.projectDir,
|
|
4689
4681
|
include: project.modules.map((item)=>item.id),
|
|
4690
4682
|
testEnvironment: 'node',
|
|
@@ -4715,18 +4707,31 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4715
4707
|
}
|
|
4716
4708
|
}
|
|
4717
4709
|
};
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4710
|
+
let result;
|
|
4711
|
+
try {
|
|
4712
|
+
const rstest = await createRstest({
|
|
4713
|
+
cwd: options.cwd || project.projectDir,
|
|
4714
|
+
config
|
|
4715
|
+
});
|
|
4716
|
+
result = await rstest.run();
|
|
4717
|
+
} catch (error) {
|
|
4718
|
+
const serialized = (0, error_formatter_namespaceObject.serializeError)(error);
|
|
4719
|
+
writePendingCaseFailures(project, new Map(project.cases.map((item)=>[
|
|
4720
|
+
item.caseId,
|
|
4721
|
+
serialized.message
|
|
4722
|
+
])));
|
|
4723
|
+
if ('pipe' !== options.stdio) console.error(`\nYAML execution failed:\n${formatRunError(serialized)}`);
|
|
4724
|
+
return 1;
|
|
4725
|
+
}
|
|
4726
|
+
const ok = 'pass' === result.status;
|
|
4727
|
+
if (!ok) {
|
|
4728
|
+
writePendingCaseFailures(project, mapRunErrorsToCases(project, result));
|
|
4724
4729
|
if ('pipe' !== options.stdio) {
|
|
4725
4730
|
const runErrors = collectRunErrors(result);
|
|
4726
4731
|
if (runErrors.length) console.error(`\nYAML execution failed:\n${runErrors.join('\n\n')}`);
|
|
4727
4732
|
}
|
|
4728
4733
|
}
|
|
4729
|
-
return
|
|
4734
|
+
return ok ? 0 : 1;
|
|
4730
4735
|
}
|
|
4731
4736
|
const defaultInProcessRunner = (config)=>new BatchRunner(config).run();
|
|
4732
4737
|
async function runConfigInMainProcess(config, commandOptions) {
|
|
@@ -4808,7 +4813,9 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4808
4813
|
"use strict";
|
|
4809
4814
|
var core_ = __webpack_require__("@midscene/core");
|
|
4810
4815
|
const cli_namespaceObject = require("@midscene/shared/cli");
|
|
4811
|
-
var package_namespaceObject =
|
|
4816
|
+
var package_namespaceObject = {
|
|
4817
|
+
rE: "1.13.1"
|
|
4818
|
+
};
|
|
4812
4819
|
var external_node_fs_ = __webpack_require__("node:fs");
|
|
4813
4820
|
var external_node_fs_namespaceObject = /*#__PURE__*/ __webpack_require__.t(external_node_fs_, 2);
|
|
4814
4821
|
var external_node_path_ = __webpack_require__("node:path");
|
|
@@ -10490,7 +10497,7 @@ Usage:
|
|
|
10490
10497
|
type: 'boolean',
|
|
10491
10498
|
description: 'Whether to dismiss the HarmonyOS keyboard after text input'
|
|
10492
10499
|
}
|
|
10493
|
-
}).version('version', 'Show version number', "1.13.1
|
|
10500
|
+
}).version('version', 'Show version number', "1.13.1").help().epilogue(`For complete list of configuration options, please visit:
|
|
10494
10501
|
• Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
|
|
10495
10502
|
• Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
|
|
10496
10503
|
• HarmonyOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-harmony-part
|