@midscene/cli 1.10.12 → 1.10.13-beta-20260813113249.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.
@@ -3784,6 +3784,7 @@ var __webpack_exports__ = {};
3784
3784
  const DEFAULT_YAML_TEST_TIMEOUT = 0;
3785
3785
  const RSTEST_YAML_BATCH_TEST_MODULE = 'virtual:midscene-yaml/batch.test.ts';
3786
3786
  const RSTEST_YAML_BATCH_TEST_NAME = 'midscene yaml batch';
3787
+ const RSTEST_YAML_SEQUENTIAL_TEST_MODULE = 'virtual:midscene-yaml/sequential.test.ts';
3787
3788
  const toPosixPath = (value)=>value.split(external_node_path_.sep).join('/');
3788
3789
  const toImportLiteral = (value)=>JSON.stringify(toPosixPath(value));
3789
3790
  const toVirtualModuleId = (fileStem)=>`virtual:midscene-yaml/${fileStem}.test.ts`;
@@ -3829,6 +3830,15 @@ const testOptions = ${JSON.stringify(testOptions, null, 2)};
3829
3830
  defineYamlBatchTest(test, testOptions);
3830
3831
  `;
3831
3832
  };
3833
+ const createGeneratedSequentialTestContent = (options)=>`import { test } from ${toImportLiteral(options.rstestCoreImport)};
3834
+ import { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};
3835
+
3836
+ const testOptionsList = ${JSON.stringify(options.testOptions, null, 2)};
3837
+
3838
+ for (const testOptions of testOptionsList) {
3839
+ defineYamlCaseTest(test.sequential, testOptions);
3840
+ }
3841
+ `;
3832
3842
  const resolveDefaultFrameworkImport = (moduleDir)=>{
3833
3843
  const anchorDir = moduleDir ?? __dirname;
3834
3844
  const candidates = [
@@ -3917,6 +3927,37 @@ defineYamlBatchTest(test, testOptions);
3917
3927
  bail: options.bail
3918
3928
  };
3919
3929
  }
3930
+ if (1 === options.maxConcurrency) return {
3931
+ projectDir,
3932
+ outputDir,
3933
+ resultDir,
3934
+ include: [
3935
+ RSTEST_YAML_SEQUENTIAL_TEST_MODULE
3936
+ ],
3937
+ virtualModules: {
3938
+ [RSTEST_YAML_SEQUENTIAL_TEST_MODULE]: createGeneratedSequentialTestContent({
3939
+ rstestCoreImport,
3940
+ frameworkImport,
3941
+ testOptions: cases.map((item)=>({
3942
+ testName: item.testName,
3943
+ yamlFile: item.yamlFile,
3944
+ resultFile: item.resultFile,
3945
+ ...options.caseOptions?.[item.yamlFile] ? {
3946
+ caseOptions: options.caseOptions[item.yamlFile]
3947
+ } : {},
3948
+ ...options.webRuntimeOptions?.[item.yamlFile] ? {
3949
+ webRuntimeOptions: options.webRuntimeOptions[item.yamlFile]
3950
+ } : {}
3951
+ }))
3952
+ })
3953
+ },
3954
+ cases,
3955
+ sequentialTestModule: RSTEST_YAML_SEQUENTIAL_TEST_MODULE,
3956
+ maxConcurrency: 1,
3957
+ testTimeout,
3958
+ bail: options.bail,
3959
+ retry: options.retry
3960
+ };
3920
3961
  return {
3921
3962
  projectDir,
3922
3963
  outputDir,
@@ -3958,6 +3999,10 @@ defineYamlBatchTest(test, testOptions);
3958
3999
  const addAll = (message)=>{
3959
4000
  for (const item of project.cases)add(item, message);
3960
4001
  };
4002
+ const matchesTestModule = (file, testModule)=>!!testModule && [
4003
+ file.name,
4004
+ file.testPath
4005
+ ].some((key)=>key === testModule || key?.includes(testModule));
3961
4006
  const matchFileCase = (file)=>{
3962
4007
  for (const key of [
3963
4008
  file.name,
@@ -3968,20 +4013,14 @@ defineYamlBatchTest(test, testOptions);
3968
4013
  if (matched) return matched;
3969
4014
  }
3970
4015
  };
3971
- const isBatchFile = (file)=>{
3972
- if (!project.batchTest) return false;
3973
- for (const key of [
3974
- file.name,
3975
- file.testPath
3976
- ])if (key && (key === project.batchTest.testModule || key.includes(project.batchTest.testModule))) return true;
3977
- return false;
3978
- };
4016
+ const isBatchFile = (file)=>matchesTestModule(file, project.batchTest?.testModule);
4017
+ const isSequentialFile = (file)=>matchesTestModule(file, project.sequentialTestModule);
3979
4018
  const isBatchTest = (testName)=>testName === project.batchTest?.testName;
3980
4019
  for (const file of result.files ?? []){
3981
4020
  const fileCase = matchFileCase(file);
3982
4021
  for (const error of file.errors ?? []){
3983
4022
  const message = rstest_runner_errorMessage(error);
3984
- if (isBatchFile(file)) addAll(message);
4023
+ if (isBatchFile(file) || isSequentialFile(file)) addAll(message);
3985
4024
  else add(fileCase, message);
3986
4025
  }
3987
4026
  for (const testResult of file.results ?? []){