@midscene/cli 1.9.5-beta-20260611051901.0 → 1.9.5
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 +22 -54
- package/dist/es/framework/index.mjs.map +1 -1
- package/dist/es/index.mjs +19 -37
- package/dist/es/index.mjs.map +1 -1
- package/dist/lib/framework/index.js +21 -53
- package/dist/lib/framework/index.js.map +1 -1
- package/dist/lib/index.js +16 -34
- package/dist/lib/index.js.map +1 -1
- package/dist/types/framework/index.d.ts +2 -18
- package/package.json +8 -8
|
@@ -3011,17 +3011,6 @@ var __webpack_exports__ = {};
|
|
|
3011
3011
|
else console.log('\n⚠️ Some files failed or were not executed.');
|
|
3012
3012
|
return success;
|
|
3013
3013
|
}
|
|
3014
|
-
const external_node_module_namespaceObject = require("node:module");
|
|
3015
|
-
const requireFromCliPackage = ()=>(0, external_node_module_namespaceObject.createRequire)((0, external_node_path_.join)(__dirname, 'index.js'));
|
|
3016
|
-
const resolvePackageFromRstestCore = (packageName)=>{
|
|
3017
|
-
const require1 = requireFromCliPackage();
|
|
3018
|
-
const rstestPackageJsonPath = require1.resolve('@rstest/core/package.json');
|
|
3019
|
-
return (0, external_node_module_namespaceObject.createRequire)(rstestPackageJsonPath).resolve(packageName);
|
|
3020
|
-
};
|
|
3021
|
-
function resolveRstestCoreImportPath() {
|
|
3022
|
-
const require1 = requireFromCliPackage();
|
|
3023
|
-
return require1.resolve('@rstest/core');
|
|
3024
|
-
}
|
|
3025
3014
|
const DEFAULT_YAML_TEST_TIMEOUT = 0;
|
|
3026
3015
|
const RSTEST_YAML_BATCH_TEST_MODULE = 'virtual:midscene-yaml/batch.test.ts';
|
|
3027
3016
|
const RSTEST_YAML_BATCH_TEST_NAME = 'midscene yaml batch';
|
|
@@ -3048,16 +3037,9 @@ var __webpack_exports__ = {};
|
|
|
3048
3037
|
webRuntimeOptions: options.webRuntimeOptions
|
|
3049
3038
|
} : {}
|
|
3050
3039
|
};
|
|
3051
|
-
return `import {
|
|
3052
|
-
import { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};
|
|
3040
|
+
return `import { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};
|
|
3053
3041
|
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
if (defineYamlCaseTest.length >= 2) {
|
|
3057
|
-
defineYamlCaseTest(test, testOptions);
|
|
3058
|
-
} else {
|
|
3059
|
-
await defineYamlCaseTest(testOptions);
|
|
3060
|
-
}
|
|
3042
|
+
defineYamlCaseTest(${JSON.stringify(testOptions, null, 2)});
|
|
3061
3043
|
`;
|
|
3062
3044
|
};
|
|
3063
3045
|
const createGeneratedBatchTestContent = (options)=>{
|
|
@@ -3066,16 +3048,9 @@ if (defineYamlCaseTest.length >= 2) {
|
|
|
3066
3048
|
config: options.config,
|
|
3067
3049
|
resultFiles: options.resultFiles
|
|
3068
3050
|
};
|
|
3069
|
-
return `import {
|
|
3070
|
-
import { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};
|
|
3051
|
+
return `import { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};
|
|
3071
3052
|
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
if (defineYamlBatchTest.length >= 2) {
|
|
3075
|
-
defineYamlBatchTest(test, testOptions);
|
|
3076
|
-
} else {
|
|
3077
|
-
await defineYamlBatchTest(testOptions);
|
|
3078
|
-
}
|
|
3053
|
+
defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
|
|
3079
3054
|
`;
|
|
3080
3055
|
};
|
|
3081
3056
|
const resolveDefaultFrameworkImport = (moduleDir)=>{
|
|
@@ -3096,7 +3071,6 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
3096
3071
|
const outputDir = options.outputDir || (0, external_node_path_.join)((0, common_namespaceObject.getMidsceneRunSubDir)('tmp'), `rstest-yaml-${Date.now()}`);
|
|
3097
3072
|
const resultDir = options.resultDir || (0, external_node_path_.join)(outputDir, 'results');
|
|
3098
3073
|
const frameworkImport = options.frameworkImport || resolveDefaultFrameworkImport();
|
|
3099
|
-
const rstestCoreImport = options.rstestCoreImport || resolveRstestCoreImportPath();
|
|
3100
3074
|
const testTimeout = options.testTimeout ?? DEFAULT_YAML_TEST_TIMEOUT;
|
|
3101
3075
|
(0, external_node_fs_.rmSync)(outputDir, {
|
|
3102
3076
|
recursive: true,
|
|
@@ -3113,7 +3087,6 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
3113
3087
|
const resultFile = (0, external_node_path_.join)(resultDir, `${fileStem}.json`);
|
|
3114
3088
|
const testModule = toVirtualModuleId(fileStem);
|
|
3115
3089
|
virtualModules[testModule] = createGeneratedTestContent({
|
|
3116
|
-
rstestCoreImport,
|
|
3117
3090
|
frameworkImport,
|
|
3118
3091
|
yamlFile,
|
|
3119
3092
|
resultFile,
|
|
@@ -3146,7 +3119,6 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
3146
3119
|
],
|
|
3147
3120
|
virtualModules: {
|
|
3148
3121
|
[batchTest.testModule]: createGeneratedBatchTestContent({
|
|
3149
|
-
rstestCoreImport,
|
|
3150
3122
|
frameworkImport,
|
|
3151
3123
|
testName: batchTest.testName,
|
|
3152
3124
|
config: options.batchConfig,
|
|
@@ -3173,7 +3145,19 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
3173
3145
|
retry: options.retry
|
|
3174
3146
|
};
|
|
3175
3147
|
}
|
|
3148
|
+
const external_node_module_namespaceObject = require("node:module");
|
|
3176
3149
|
var external_node_url_ = __webpack_require__("node:url");
|
|
3150
|
+
const requireFromCliPackage = ()=>(0, external_node_module_namespaceObject.createRequire)((0, external_node_path_.join)(__dirname, 'index.js'));
|
|
3151
|
+
const resolvePackageFromRstestCore = (packageName)=>{
|
|
3152
|
+
const require1 = requireFromCliPackage();
|
|
3153
|
+
const rstestPackageJsonPath = require1.resolve('@rstest/core/package.json');
|
|
3154
|
+
return (0, external_node_module_namespaceObject.createRequire)(rstestPackageJsonPath).resolve(packageName);
|
|
3155
|
+
};
|
|
3156
|
+
function resolveRstestCoreImportPath() {
|
|
3157
|
+
const require1 = requireFromCliPackage();
|
|
3158
|
+
const packageJsonPath = require1.resolve('@rstest/core/package.json');
|
|
3159
|
+
return (0, external_node_path_.join)((0, external_node_path_.dirname)(packageJsonPath), 'dist', 'index.js');
|
|
3160
|
+
}
|
|
3177
3161
|
const formatRunError = (error)=>error.stack || `${error.name}: ${error.message}`;
|
|
3178
3162
|
const collectRunErrors = (result)=>{
|
|
3179
3163
|
const messages = [];
|
|
@@ -3356,6 +3340,7 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
3356
3340
|
const success = printExecutionSummary(results, summaryPath);
|
|
3357
3341
|
return success ? exitCode : 1;
|
|
3358
3342
|
}
|
|
3343
|
+
const external_rstest_core_namespaceObject = require("@rstest/core");
|
|
3359
3344
|
var yaml_ = __webpack_require__("@midscene/core/yaml");
|
|
3360
3345
|
const puppeteer_agent_launcher_namespaceObject = require("@midscene/web/puppeteer-agent-launcher");
|
|
3361
3346
|
var external_lodash_merge_ = __webpack_require__("lodash.merge");
|
|
@@ -4186,13 +4171,8 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
4186
4171
|
resultType: 'failed',
|
|
4187
4172
|
error: rstest_entry_errorMessageOf(error)
|
|
4188
4173
|
});
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
if (!rstestCorePromise) rstestCorePromise = import("@rstest/core");
|
|
4192
|
-
return (await rstestCorePromise).test;
|
|
4193
|
-
};
|
|
4194
|
-
const registerYamlCaseTest = (test, options)=>{
|
|
4195
|
-
test(options.testName, async ()=>{
|
|
4174
|
+
function defineYamlCaseTest(options) {
|
|
4175
|
+
(0, external_rstest_core_namespaceObject.test)(options.testName, async ()=>{
|
|
4196
4176
|
const file = (0, external_node_path_.resolve)(options.yamlFile);
|
|
4197
4177
|
const startTime = Date.now();
|
|
4198
4178
|
let result;
|
|
@@ -4213,26 +4193,14 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
4213
4193
|
throw error;
|
|
4214
4194
|
}
|
|
4215
4195
|
});
|
|
4216
|
-
};
|
|
4217
|
-
function defineYamlCaseTest(testOrOptions, maybeOptions) {
|
|
4218
|
-
if (maybeOptions) return void registerYamlCaseTest(testOrOptions, maybeOptions);
|
|
4219
|
-
return loadRstestTest().then((test)=>{
|
|
4220
|
-
registerYamlCaseTest(test, testOrOptions);
|
|
4221
|
-
});
|
|
4222
4196
|
}
|
|
4223
|
-
|
|
4224
|
-
test(options.testName, async ()=>{
|
|
4197
|
+
function defineYamlBatchTest(options) {
|
|
4198
|
+
(0, external_rstest_core_namespaceObject.test)(options.testName, async ()=>{
|
|
4225
4199
|
await runYamlBatchInRstest({
|
|
4226
4200
|
config: options.config,
|
|
4227
4201
|
resultFiles: options.resultFiles
|
|
4228
4202
|
});
|
|
4229
4203
|
});
|
|
4230
|
-
};
|
|
4231
|
-
function defineYamlBatchTest(testOrOptions, maybeOptions) {
|
|
4232
|
-
if (maybeOptions) return void registerYamlBatchTest(testOrOptions, maybeOptions);
|
|
4233
|
-
return loadRstestTest().then((test)=>{
|
|
4234
|
-
registerYamlBatchTest(test, testOrOptions);
|
|
4235
|
-
});
|
|
4236
4204
|
}
|
|
4237
4205
|
})();
|
|
4238
4206
|
exports.createRstestYamlProject = __webpack_exports__.createRstestYamlProject;
|