@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/lib/index.js CHANGED
@@ -3207,6 +3207,18 @@ var __webpack_modules__ = {
3207
3207
  else console.log('\n⚠️ Some files failed or were not executed.');
3208
3208
  return success;
3209
3209
  }
3210
+ const external_node_module_namespaceObject = require("node:module");
3211
+ const requireFromCliPackage = ()=>(0, external_node_module_namespaceObject.createRequire)((0, external_node_path_.join)(__dirname, 'index.js'));
3212
+ const resolvePackageFromRstestCore = (packageName)=>{
3213
+ const require1 = requireFromCliPackage();
3214
+ const rstestPackageJsonPath = require1.resolve('@rstest/core/package.json');
3215
+ return (0, external_node_module_namespaceObject.createRequire)(rstestPackageJsonPath).resolve(packageName);
3216
+ };
3217
+ function resolveRstestCoreImportPath() {
3218
+ const require1 = requireFromCliPackage();
3219
+ const packageJsonPath = require1.resolve('@rstest/core/package.json');
3220
+ return (0, external_node_path_.join)((0, external_node_path_.dirname)(packageJsonPath), 'dist', 'index.js');
3221
+ }
3210
3222
  const DEFAULT_YAML_TEST_TIMEOUT = 0;
3211
3223
  const RSTEST_YAML_BATCH_TEST_MODULE = 'virtual:midscene-yaml/batch.test.ts';
3212
3224
  const RSTEST_YAML_BATCH_TEST_NAME = 'midscene yaml batch';
@@ -3233,9 +3245,16 @@ var __webpack_modules__ = {
3233
3245
  webRuntimeOptions: options.webRuntimeOptions
3234
3246
  } : {}
3235
3247
  };
3236
- return `import { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};
3248
+ return `import { test } from ${toImportLiteral(options.rstestCoreImport)};
3249
+ import { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};
3237
3250
 
3238
- defineYamlCaseTest(${JSON.stringify(testOptions, null, 2)});
3251
+ const testOptions = ${JSON.stringify(testOptions, null, 2)};
3252
+
3253
+ if (defineYamlCaseTest.length >= 2) {
3254
+ defineYamlCaseTest(test, testOptions);
3255
+ } else {
3256
+ defineYamlCaseTest(testOptions);
3257
+ }
3239
3258
  `;
3240
3259
  };
3241
3260
  const createGeneratedBatchTestContent = (options)=>{
@@ -3244,9 +3263,16 @@ defineYamlCaseTest(${JSON.stringify(testOptions, null, 2)});
3244
3263
  config: options.config,
3245
3264
  resultFiles: options.resultFiles
3246
3265
  };
3247
- return `import { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};
3266
+ return `import { test } from ${toImportLiteral(options.rstestCoreImport)};
3267
+ import { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};
3248
3268
 
3249
- defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
3269
+ const testOptions = ${JSON.stringify(testOptions, null, 2)};
3270
+
3271
+ if (defineYamlBatchTest.length >= 2) {
3272
+ defineYamlBatchTest(test, testOptions);
3273
+ } else {
3274
+ defineYamlBatchTest(testOptions);
3275
+ }
3250
3276
  `;
3251
3277
  };
3252
3278
  const resolveDefaultFrameworkImport = (moduleDir)=>{
@@ -3267,6 +3293,7 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
3267
3293
  const outputDir = options.outputDir || (0, external_node_path_.join)((0, common_namespaceObject.getMidsceneRunSubDir)('tmp'), `rstest-yaml-${Date.now()}`);
3268
3294
  const resultDir = options.resultDir || (0, external_node_path_.join)(outputDir, 'results');
3269
3295
  const frameworkImport = options.frameworkImport || resolveDefaultFrameworkImport();
3296
+ const rstestCoreImport = options.rstestCoreImport || resolveRstestCoreImportPath();
3270
3297
  const testTimeout = options.testTimeout ?? DEFAULT_YAML_TEST_TIMEOUT;
3271
3298
  (0, external_node_fs_.rmSync)(outputDir, {
3272
3299
  recursive: true,
@@ -3283,6 +3310,7 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
3283
3310
  const resultFile = (0, external_node_path_.join)(resultDir, `${fileStem}.json`);
3284
3311
  const testModule = toVirtualModuleId(fileStem);
3285
3312
  virtualModules[testModule] = createGeneratedTestContent({
3313
+ rstestCoreImport,
3286
3314
  frameworkImport,
3287
3315
  yamlFile,
3288
3316
  resultFile,
@@ -3315,6 +3343,7 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
3315
3343
  ],
3316
3344
  virtualModules: {
3317
3345
  [batchTest.testModule]: createGeneratedBatchTestContent({
3346
+ rstestCoreImport,
3318
3347
  frameworkImport,
3319
3348
  testName: batchTest.testName,
3320
3349
  config: options.batchConfig,
@@ -3341,14 +3370,7 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
3341
3370
  retry: options.retry
3342
3371
  };
3343
3372
  }
3344
- const external_node_module_namespaceObject = require("node:module");
3345
3373
  var external_node_url_ = __webpack_require__("node:url");
3346
- const requireFromCliPackage = ()=>(0, external_node_module_namespaceObject.createRequire)((0, external_node_path_.join)(__dirname, 'index.js'));
3347
- const resolvePackageFromRstestCore = (packageName)=>{
3348
- const require1 = requireFromCliPackage();
3349
- const rstestPackageJsonPath = require1.resolve('@rstest/core/package.json');
3350
- return (0, external_node_module_namespaceObject.createRequire)(rstestPackageJsonPath).resolve(packageName);
3351
- };
3352
3374
  const formatRunError = (error)=>error.stack || `${error.name}: ${error.message}`;
3353
3375
  const collectRunErrors = (result)=>{
3354
3376
  const messages = [];
@@ -3531,7 +3553,6 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
3531
3553
  const success = printExecutionSummary(results, summaryPath);
3532
3554
  return success ? exitCode : 1;
3533
3555
  }
3534
- require("@rstest/core");
3535
3556
  __webpack_require__("@midscene/core/yaml");
3536
3557
  require("@midscene/web/puppeteer-agent-launcher");
3537
3558
  __webpack_require__("lodash.merge");
@@ -3555,9 +3576,7 @@ defineYamlBatchTest(${JSON.stringify(testOptions, null, 2)});
3555
3576
  const cli_namespaceObject = require("@midscene/shared/cli");
3556
3577
  var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js");
3557
3578
  var main_default = /*#__PURE__*/ __webpack_require__.n(main);
3558
- var package_namespaceObject = {
3559
- rE: "1.9.4"
3560
- };
3579
+ var package_namespaceObject = JSON.parse('{"rE":"1.9.5-beta-20260611031026.0"}');
3561
3580
  var logger_ = __webpack_require__("@midscene/shared/logger");
3562
3581
  var brace_expansion = __webpack_require__("../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js");
3563
3582
  const MAX_PATTERN_LENGTH = 65536;
@@ -11399,7 +11418,7 @@ Usage:
11399
11418
  type: 'boolean',
11400
11419
  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}`
11401
11420
  }
11402
- }).version('version', 'Show version number', "1.9.4").help().epilogue(`For complete list of configuration options, please visit:
11421
+ }).version('version', 'Show version number', "1.9.5-beta-20260611031026.0").help().epilogue(`For complete list of configuration options, please visit:
11403
11422
  • Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
11404
11423
  • Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
11405
11424
  • iOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-ios-part