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