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