@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
|
@@ -4044,29 +4044,26 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4044
4044
|
};
|
|
4045
4045
|
}
|
|
4046
4046
|
var external_node_url_ = __webpack_require__("node:url");
|
|
4047
|
+
const error_formatter_namespaceObject = require("@midscene/shared/agent-tools/error-formatter");
|
|
4047
4048
|
var progress_reporter = __webpack_require__("./src/framework/progress-reporter.ts");
|
|
4048
4049
|
var rstest_contract = __webpack_require__("./src/framework/rstest-contract.ts");
|
|
4049
|
-
const formatRunError = (error)=>error.stack || `${error.name}: ${error.message}`;
|
|
4050
|
+
const formatRunError = (error)=>error.stack || `${error.name || 'Error'}: ${error.message}`;
|
|
4050
4051
|
const collectRunErrors = (result)=>{
|
|
4051
4052
|
const messages = [];
|
|
4052
4053
|
const push = (error, label)=>{
|
|
4053
4054
|
const formatted = formatRunError(error);
|
|
4054
4055
|
messages.push(label ? `${label}: ${formatted}` : formatted);
|
|
4055
4056
|
};
|
|
4056
|
-
for (const file of result.
|
|
4057
|
+
for (const file of result.results){
|
|
4057
4058
|
for (const error of file.errors ?? [])push(error, file.name || file.testPath);
|
|
4058
4059
|
for (const testResult of file.results ?? [])for (const error of testResult.errors ?? [])push(error, testResult.name);
|
|
4059
4060
|
}
|
|
4060
|
-
for (const error of result.unhandledErrors
|
|
4061
|
+
for (const error of result.unhandledErrors)push(error);
|
|
4061
4062
|
return Array.from(new Set(messages));
|
|
4062
4063
|
};
|
|
4063
4064
|
const rstest_runner_errorMessage = (error)=>error.message || error.name || 'YAML case failed';
|
|
4064
4065
|
const mapRunErrorsToCases = (project, result)=>{
|
|
4065
|
-
const
|
|
4066
|
-
item.caseId,
|
|
4067
|
-
item
|
|
4068
|
-
]));
|
|
4069
|
-
const knownCaseIds = new Set(casesById.keys());
|
|
4066
|
+
const knownCaseIds = new Set(project.cases.map((item)=>item.caseId));
|
|
4070
4067
|
const errors = new Map();
|
|
4071
4068
|
const add = (caseId, message)=>{
|
|
4072
4069
|
if (knownCaseIds.has(caseId) && message && !errors.has(caseId)) errors.set(caseId, message);
|
|
@@ -4089,7 +4086,7 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4089
4086
|
const value = testResult.meta?.[rstest_contract.k];
|
|
4090
4087
|
return Array.isArray(value) ? value.filter((item)=>'string' == typeof item) : [];
|
|
4091
4088
|
};
|
|
4092
|
-
for (const file of result.
|
|
4089
|
+
for (const file of result.results){
|
|
4093
4090
|
const moduleCaseIds = findModuleCaseIds(file);
|
|
4094
4091
|
for (const error of file.errors ?? [])addCases(moduleCaseIds, rstest_runner_errorMessage(error));
|
|
4095
4092
|
for (const testResult of file.results ?? []){
|
|
@@ -4097,18 +4094,13 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4097
4094
|
for (const error of testResult.errors ?? [])addCases(caseIds.length ? caseIds : moduleCaseIds, rstest_runner_errorMessage(error));
|
|
4098
4095
|
}
|
|
4099
4096
|
}
|
|
4100
|
-
if (
|
|
4097
|
+
if (result.unhandledErrors.length) {
|
|
4101
4098
|
const message = rstest_runner_errorMessage(result.unhandledErrors[0]);
|
|
4102
|
-
for (const
|
|
4103
|
-
const item = casesById.get(caseId);
|
|
4104
|
-
if (!errors.has(caseId) || item && !(0, external_node_fs_.existsSync)(item.resultFile)) errors.set(caseId, message);
|
|
4105
|
-
}
|
|
4099
|
+
for (const item of project.cases)if (!errors.has(item.caseId) && !(0, external_node_fs_.existsSync)(item.resultFile)) errors.set(item.caseId, message);
|
|
4106
4100
|
}
|
|
4107
4101
|
return errors;
|
|
4108
4102
|
};
|
|
4109
|
-
const
|
|
4110
|
-
if (!project.cases.length) return;
|
|
4111
|
-
const caseErrors = mapRunErrorsToCases(project, result);
|
|
4103
|
+
const writePendingCaseFailures = (project, caseErrors)=>{
|
|
4112
4104
|
for (const item of project.cases){
|
|
4113
4105
|
if ((0, external_node_fs_.existsSync)(item.resultFile)) continue;
|
|
4114
4106
|
const error = caseErrors.get(item.caseId);
|
|
@@ -4130,13 +4122,13 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4130
4122
|
}
|
|
4131
4123
|
};
|
|
4132
4124
|
async function runRstestYamlProject(options) {
|
|
4133
|
-
const [{
|
|
4125
|
+
const [{ createRstest }, { rspack }] = await Promise.all([
|
|
4134
4126
|
import("@rstest/core/api"),
|
|
4135
4127
|
import((0, external_node_url_.pathToFileURL)(resolvePackageFromRstestCore('@rsbuild/core')).href)
|
|
4136
4128
|
]);
|
|
4137
4129
|
const { project } = options;
|
|
4138
4130
|
const maxConcurrency = void 0 !== project.maxConcurrency ? Math.max(1, project.maxConcurrency) : void 0;
|
|
4139
|
-
const
|
|
4131
|
+
const config = {
|
|
4140
4132
|
root: project.projectDir,
|
|
4141
4133
|
include: project.modules.map((item)=>item.id),
|
|
4142
4134
|
testEnvironment: 'node',
|
|
@@ -4167,18 +4159,31 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4167
4159
|
}
|
|
4168
4160
|
}
|
|
4169
4161
|
};
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4162
|
+
let result;
|
|
4163
|
+
try {
|
|
4164
|
+
const rstest = await createRstest({
|
|
4165
|
+
cwd: options.cwd || project.projectDir,
|
|
4166
|
+
config
|
|
4167
|
+
});
|
|
4168
|
+
result = await rstest.run();
|
|
4169
|
+
} catch (error) {
|
|
4170
|
+
const serialized = (0, error_formatter_namespaceObject.serializeError)(error);
|
|
4171
|
+
writePendingCaseFailures(project, new Map(project.cases.map((item)=>[
|
|
4172
|
+
item.caseId,
|
|
4173
|
+
serialized.message
|
|
4174
|
+
])));
|
|
4175
|
+
if ('pipe' !== options.stdio) console.error(`\nYAML execution failed:\n${formatRunError(serialized)}`);
|
|
4176
|
+
return 1;
|
|
4177
|
+
}
|
|
4178
|
+
const ok = 'pass' === result.status;
|
|
4179
|
+
if (!ok) {
|
|
4180
|
+
writePendingCaseFailures(project, mapRunErrorsToCases(project, result));
|
|
4176
4181
|
if ('pipe' !== options.stdio) {
|
|
4177
4182
|
const runErrors = collectRunErrors(result);
|
|
4178
4183
|
if (runErrors.length) console.error(`\nYAML execution failed:\n${runErrors.join('\n\n')}`);
|
|
4179
4184
|
}
|
|
4180
4185
|
}
|
|
4181
|
-
return
|
|
4186
|
+
return ok ? 0 : 1;
|
|
4182
4187
|
}
|
|
4183
4188
|
const defaultInProcessRunner = (config)=>new BatchRunner(config).run();
|
|
4184
4189
|
async function runConfigInMainProcess(config, commandOptions) {
|