@midscene/cli 1.9.1 → 1.9.2-beta-20260605092310.0
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 +82 -6
- package/dist/es/framework/index.mjs.map +1 -1
- package/dist/es/index.mjs +84 -10
- package/dist/es/index.mjs.map +1 -1
- package/dist/lib/framework/index.js +82 -6
- package/dist/lib/framework/index.js.map +1 -1
- package/dist/lib/index.js +84 -10
- package/dist/lib/index.js.map +1 -1
- package/package.json +8 -8
package/dist/lib/index.js
CHANGED
|
@@ -3172,12 +3172,15 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
|
|
|
3172
3172
|
`;
|
|
3173
3173
|
};
|
|
3174
3174
|
const resolveDefaultFrameworkImport = ()=>{
|
|
3175
|
-
const entry = process.argv[1] ? (0, external_node_path_.resolve)(process.argv[1]) : '';
|
|
3176
3175
|
const candidates = [
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
].
|
|
3180
|
-
|
|
3176
|
+
(0, external_node_path_.join)(__dirname, 'framework', 'index.js')
|
|
3177
|
+
];
|
|
3178
|
+
const entry = process.argv[1] ? (0, external_node_path_.resolve)(process.argv[1]) : '';
|
|
3179
|
+
if (entry) {
|
|
3180
|
+
candidates.push((0, external_node_path_.join)((0, external_node_path_.dirname)(entry), 'framework', 'index.js'));
|
|
3181
|
+
candidates.push((0, external_node_path_.join)((0, external_node_path_.dirname)(entry), '..', 'dist', 'lib', 'framework', 'index.js'));
|
|
3182
|
+
}
|
|
3183
|
+
const matched = candidates.filter(Boolean).find((candidate)=>(0, external_node_fs_.existsSync)(candidate));
|
|
3181
3184
|
return matched || '@midscene/cli/dist/lib/framework/index.js';
|
|
3182
3185
|
};
|
|
3183
3186
|
function createRstestYamlProject(options) {
|
|
@@ -3263,6 +3266,73 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
|
|
|
3263
3266
|
return (0, external_node_module_namespaceObject.createRequire)(rstestPackageJsonPath).resolve(packageName);
|
|
3264
3267
|
};
|
|
3265
3268
|
const formatRunError = (error)=>error.stack || `${error.name}: ${error.message}`;
|
|
3269
|
+
const collectRunErrors = (result)=>{
|
|
3270
|
+
const messages = [];
|
|
3271
|
+
const push = (error, label)=>{
|
|
3272
|
+
const formatted = formatRunError(error);
|
|
3273
|
+
messages.push(label ? `${label}: ${formatted}` : formatted);
|
|
3274
|
+
};
|
|
3275
|
+
for (const file of result.files ?? []){
|
|
3276
|
+
for (const error of file.errors ?? [])push(error, file.name || file.testPath);
|
|
3277
|
+
for (const testResult of file.results ?? [])for (const error of testResult.errors ?? [])push(error, testResult.name);
|
|
3278
|
+
}
|
|
3279
|
+
for (const error of result.unhandledErrors ?? [])push(error);
|
|
3280
|
+
return Array.from(new Set(messages));
|
|
3281
|
+
};
|
|
3282
|
+
const rstest_runner_errorMessage = (error)=>error.message || error.name || 'YAML case failed';
|
|
3283
|
+
const mapRunErrorsToCases = (project, result)=>{
|
|
3284
|
+
const byTestName = new Map(project.cases.map((item)=>[
|
|
3285
|
+
item.testName,
|
|
3286
|
+
item
|
|
3287
|
+
]));
|
|
3288
|
+
const errors = new Map();
|
|
3289
|
+
const add = (item, message)=>{
|
|
3290
|
+
if (item && message && !errors.has(item.yamlFile)) errors.set(item.yamlFile, message);
|
|
3291
|
+
};
|
|
3292
|
+
const matchFileCase = (file)=>{
|
|
3293
|
+
for (const key of [
|
|
3294
|
+
file.name,
|
|
3295
|
+
file.testPath
|
|
3296
|
+
]){
|
|
3297
|
+
if (!key) continue;
|
|
3298
|
+
const matched = project.cases.find((item)=>key === item.testModule || key.includes(item.testModule));
|
|
3299
|
+
if (matched) return matched;
|
|
3300
|
+
}
|
|
3301
|
+
};
|
|
3302
|
+
for (const file of result.files ?? []){
|
|
3303
|
+
const fileCase = matchFileCase(file);
|
|
3304
|
+
for (const error of file.errors ?? [])add(fileCase, rstest_runner_errorMessage(error));
|
|
3305
|
+
for (const testResult of file.results ?? []){
|
|
3306
|
+
const item = byTestName.get(testResult.name) ?? fileCase;
|
|
3307
|
+
for (const error of testResult.errors ?? [])add(item, rstest_runner_errorMessage(error));
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
if (1 === project.cases.length && 0 === errors.size && result.unhandledErrors?.length) add(project.cases[0], rstest_runner_errorMessage(result.unhandledErrors[0]));
|
|
3311
|
+
return errors;
|
|
3312
|
+
};
|
|
3313
|
+
const recordUnreportedCaseFailures = (project, result)=>{
|
|
3314
|
+
if (!project.cases.length) return;
|
|
3315
|
+
const caseErrors = mapRunErrorsToCases(project, result);
|
|
3316
|
+
for (const item of project.cases){
|
|
3317
|
+
if ((0, external_node_fs_.existsSync)(item.resultFile)) continue;
|
|
3318
|
+
const error = caseErrors.get(item.yamlFile);
|
|
3319
|
+
if (!error) continue;
|
|
3320
|
+
const failure = {
|
|
3321
|
+
file: item.yamlFile,
|
|
3322
|
+
success: false,
|
|
3323
|
+
executed: true,
|
|
3324
|
+
output: void 0,
|
|
3325
|
+
report: void 0,
|
|
3326
|
+
duration: 0,
|
|
3327
|
+
resultType: 'failed',
|
|
3328
|
+
error
|
|
3329
|
+
};
|
|
3330
|
+
(0, external_node_fs_.mkdirSync)((0, external_node_path_.dirname)(item.resultFile), {
|
|
3331
|
+
recursive: true
|
|
3332
|
+
});
|
|
3333
|
+
(0, external_node_fs_.writeFileSync)(item.resultFile, JSON.stringify(failure, null, 2));
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3266
3336
|
async function runRstestYamlProject(options) {
|
|
3267
3337
|
const [{ runRstest }, { rspack }] = await Promise.all([
|
|
3268
3338
|
import("@rstest/core/api"),
|
|
@@ -3298,7 +3368,13 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
|
|
|
3298
3368
|
cwd: options.cwd || project.projectDir,
|
|
3299
3369
|
inlineConfig
|
|
3300
3370
|
});
|
|
3301
|
-
if (!result.ok
|
|
3371
|
+
if (!result.ok) {
|
|
3372
|
+
recordUnreportedCaseFailures(project, result);
|
|
3373
|
+
if ('pipe' !== options.stdio) {
|
|
3374
|
+
const runErrors = collectRunErrors(result);
|
|
3375
|
+
if (runErrors.length) console.error(`\nYAML execution failed:\n${runErrors.join('\n\n')}`);
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3302
3378
|
return result.ok ? 0 : 1;
|
|
3303
3379
|
}
|
|
3304
3380
|
const createCaseOptions = (config)=>{
|
|
@@ -3371,9 +3447,7 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
|
|
|
3371
3447
|
const cli_namespaceObject = require("@midscene/shared/cli");
|
|
3372
3448
|
var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js");
|
|
3373
3449
|
var main_default = /*#__PURE__*/ __webpack_require__.n(main);
|
|
3374
|
-
var package_namespaceObject = {
|
|
3375
|
-
rE: "1.9.1"
|
|
3376
|
-
};
|
|
3450
|
+
var package_namespaceObject = JSON.parse('{"rE":"1.9.2-beta-20260605092310.0"}');
|
|
3377
3451
|
var logger_ = __webpack_require__("@midscene/shared/logger");
|
|
3378
3452
|
var brace_expansion = __webpack_require__("../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js");
|
|
3379
3453
|
const MAX_PATTERN_LENGTH = 65536;
|
|
@@ -11207,7 +11281,7 @@ Usage:
|
|
|
11207
11281
|
type: 'boolean',
|
|
11208
11282
|
description: `Turn on logging to help debug why certain keys or values are not being set as you expect, default is ${config_factory_defaultConfig.dotenvDebug}`
|
|
11209
11283
|
}
|
|
11210
|
-
}).version('version', 'Show version number', "1.9.
|
|
11284
|
+
}).version('version', 'Show version number', "1.9.2-beta-20260605092310.0").help().epilogue(`For complete list of configuration options, please visit:
|
|
11211
11285
|
• Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
|
|
11212
11286
|
• Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
|
|
11213
11287
|
• iOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-ios-part
|