@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
package/dist/es/index.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import lodash_merge from "lodash.merge";
|
|
|
15
15
|
import { createHash } from "node:crypto";
|
|
16
16
|
import { getMidsceneRunSubDir } from "@midscene/shared/common";
|
|
17
17
|
import { createRequire } from "node:module";
|
|
18
|
+
import "@rstest/core";
|
|
18
19
|
import "@midscene/web/puppeteer-agent-launcher";
|
|
19
20
|
import "puppeteer";
|
|
20
21
|
import "http-server";
|
|
@@ -3026,7 +3027,9 @@ var __webpack_modules__ = {
|
|
|
3026
3027
|
"./src/index.ts" (__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
3027
3028
|
var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js");
|
|
3028
3029
|
var main_default = /*#__PURE__*/ __webpack_require__.n(main);
|
|
3029
|
-
var package_namespaceObject =
|
|
3030
|
+
var package_namespaceObject = {
|
|
3031
|
+
rE: "1.9.5"
|
|
3032
|
+
};
|
|
3030
3033
|
var brace_expansion = __webpack_require__("../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js");
|
|
3031
3034
|
const MAX_PATTERN_LENGTH = 65536;
|
|
3032
3035
|
const assertValidPattern = (pattern)=>{
|
|
@@ -10857,7 +10860,7 @@ Usage:
|
|
|
10857
10860
|
type: 'boolean',
|
|
10858
10861
|
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}`
|
|
10859
10862
|
}
|
|
10860
|
-
}).version('version', 'Show version number', "1.9.5
|
|
10863
|
+
}).version('version', 'Show version number', "1.9.5").help().epilogue(`For complete list of configuration options, please visit:
|
|
10861
10864
|
• Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
|
|
10862
10865
|
• Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
|
|
10863
10866
|
• iOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-ios-part
|
|
@@ -11094,20 +11097,6 @@ Examples:
|
|
|
11094
11097
|
else console.log('\n⚠️ Some files failed or were not executed.');
|
|
11095
11098
|
return success;
|
|
11096
11099
|
}
|
|
11097
|
-
const requireFromCliPackage = ()=>{
|
|
11098
|
-
if ('undefined' != typeof __dirname) return createRequire(external_node_path_join(__dirname, 'index.js'));
|
|
11099
|
-
const entry = process.argv[1] ? external_node_path_resolve(process.argv[1]) : external_node_path_join(process.cwd(), 'midscene-cli.js');
|
|
11100
|
-
return createRequire(entry);
|
|
11101
|
-
};
|
|
11102
|
-
const resolvePackageFromRstestCore = (packageName)=>{
|
|
11103
|
-
const require1 = requireFromCliPackage();
|
|
11104
|
-
const rstestPackageJsonPath = require1.resolve('@rstest/core/package.json');
|
|
11105
|
-
return createRequire(rstestPackageJsonPath).resolve(packageName);
|
|
11106
|
-
};
|
|
11107
|
-
function resolveRstestCoreImportPath() {
|
|
11108
|
-
const require1 = requireFromCliPackage();
|
|
11109
|
-
return require1.resolve('@rstest/core');
|
|
11110
|
-
}
|
|
11111
11100
|
const DEFAULT_YAML_TEST_TIMEOUT = 0;
|
|
11112
11101
|
const RSTEST_YAML_BATCH_TEST_MODULE = 'virtual:midscene-yaml/batch.test.ts';
|
|
11113
11102
|
const RSTEST_YAML_BATCH_TEST_NAME = 'midscene yaml batch';
|
|
@@ -11134,16 +11123,9 @@ Examples:
|
|
|
11134
11123
|
webRuntimeOptions: options.webRuntimeOptions
|
|
11135
11124
|
} : {}
|
|
11136
11125
|
};
|
|
11137
|
-
return `import {
|
|
11138
|
-
import { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};
|
|
11139
|
-
|
|
11140
|
-
const testOptions = ${JSON.stringify(testOptions, null, 2)};
|
|
11126
|
+
return `import { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};
|
|
11141
11127
|
|
|
11142
|
-
|
|
11143
|
-
defineYamlCaseTest(test, testOptions);
|
|
11144
|
-
} else {
|
|
11145
|
-
await defineYamlCaseTest(testOptions);
|
|
11146
|
-
}
|
|
11128
|
+
defineYamlCaseTest(${JSON.stringify(testOptions, null, 2)});
|
|
11147
11129
|
`;
|
|
11148
11130
|
};
|
|
11149
11131
|
const createGeneratedBatchTestContent = (options)=>{
|
|
@@ -11152,16 +11134,9 @@ if (defineYamlCaseTest.length >= 2) {
|
|
|
11152
11134
|
config: options.config,
|
|
11153
11135
|
resultFiles: options.resultFiles
|
|
11154
11136
|
};
|
|
11155
|
-
return `import {
|
|
11156
|
-
import { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};
|
|
11157
|
-
|
|
11158
|
-
const testOptions = ${JSON.stringify(testOptions, null, 2)};
|
|
11137
|
+
return `import { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};
|
|
11159
11138
|
|
|
11160
|
-
|
|
11161
|
-
defineYamlBatchTest(test, testOptions);
|
|
11162
|
-
} else {
|
|
11163
|
-
await defineYamlBatchTest(testOptions);
|
|
11164
|
-
}
|
|
11139
|
+
defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
|
|
11165
11140
|
`;
|
|
11166
11141
|
};
|
|
11167
11142
|
const resolveDefaultFrameworkImport = (moduleDir)=>{
|
|
@@ -11182,7 +11157,6 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
11182
11157
|
const outputDir = options.outputDir || external_node_path_join(getMidsceneRunSubDir('tmp'), `rstest-yaml-${Date.now()}`);
|
|
11183
11158
|
const resultDir = options.resultDir || external_node_path_join(outputDir, 'results');
|
|
11184
11159
|
const frameworkImport = options.frameworkImport || resolveDefaultFrameworkImport();
|
|
11185
|
-
const rstestCoreImport = options.rstestCoreImport || resolveRstestCoreImportPath();
|
|
11186
11160
|
const testTimeout = options.testTimeout ?? DEFAULT_YAML_TEST_TIMEOUT;
|
|
11187
11161
|
(0, __rspack_external_node_fs_5ea92f0c.rmSync)(outputDir, {
|
|
11188
11162
|
recursive: true,
|
|
@@ -11199,7 +11173,6 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
11199
11173
|
const resultFile = external_node_path_join(resultDir, `${fileStem}.json`);
|
|
11200
11174
|
const testModule = toVirtualModuleId(fileStem);
|
|
11201
11175
|
virtualModules[testModule] = createGeneratedTestContent({
|
|
11202
|
-
rstestCoreImport,
|
|
11203
11176
|
frameworkImport,
|
|
11204
11177
|
yamlFile,
|
|
11205
11178
|
resultFile,
|
|
@@ -11232,7 +11205,6 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
11232
11205
|
],
|
|
11233
11206
|
virtualModules: {
|
|
11234
11207
|
[batchTest.testModule]: createGeneratedBatchTestContent({
|
|
11235
|
-
rstestCoreImport,
|
|
11236
11208
|
frameworkImport,
|
|
11237
11209
|
testName: batchTest.testName,
|
|
11238
11210
|
config: options.batchConfig,
|
|
@@ -11259,6 +11231,16 @@ if (defineYamlBatchTest.length >= 2) {
|
|
|
11259
11231
|
retry: options.retry
|
|
11260
11232
|
};
|
|
11261
11233
|
}
|
|
11234
|
+
const requireFromCliPackage = ()=>{
|
|
11235
|
+
if ('undefined' != typeof __dirname) return createRequire(external_node_path_join(__dirname, 'index.js'));
|
|
11236
|
+
const entry = process.argv[1] ? external_node_path_resolve(process.argv[1]) : external_node_path_join(process.cwd(), 'midscene-cli.js');
|
|
11237
|
+
return createRequire(entry);
|
|
11238
|
+
};
|
|
11239
|
+
const resolvePackageFromRstestCore = (packageName)=>{
|
|
11240
|
+
const require1 = requireFromCliPackage();
|
|
11241
|
+
const rstestPackageJsonPath = require1.resolve('@rstest/core/package.json');
|
|
11242
|
+
return createRequire(rstestPackageJsonPath).resolve(packageName);
|
|
11243
|
+
};
|
|
11262
11244
|
const formatRunError = (error)=>error.stack || `${error.name}: ${error.message}`;
|
|
11263
11245
|
const collectRunErrors = (result)=>{
|
|
11264
11246
|
const messages = [];
|