@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.
@@ -3717,6 +3717,7 @@ function resolveRstestCoreImportPath() {
3717
3717
  const DEFAULT_YAML_TEST_TIMEOUT = 0;
3718
3718
  const RSTEST_YAML_BATCH_TEST_MODULE = 'virtual:midscene-yaml/batch.test.ts';
3719
3719
  const RSTEST_YAML_BATCH_TEST_NAME = 'midscene yaml batch';
3720
+ const RSTEST_YAML_SEQUENTIAL_TEST_MODULE = 'virtual:midscene-yaml/sequential.test.ts';
3720
3721
  const toPosixPath = (value)=>value.split(sep).join('/');
3721
3722
  const toImportLiteral = (value)=>JSON.stringify(toPosixPath(value));
3722
3723
  const toVirtualModuleId = (fileStem)=>`virtual:midscene-yaml/${fileStem}.test.ts`;
@@ -3762,6 +3763,15 @@ const testOptions = ${JSON.stringify(testOptions, null, 2)};
3762
3763
  defineYamlBatchTest(test, testOptions);
3763
3764
  `;
3764
3765
  };
3766
+ const createGeneratedSequentialTestContent = (options)=>`import { test } from ${toImportLiteral(options.rstestCoreImport)};
3767
+ import { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};
3768
+
3769
+ const testOptionsList = ${JSON.stringify(options.testOptions, null, 2)};
3770
+
3771
+ for (const testOptions of testOptionsList) {
3772
+ defineYamlCaseTest(test.sequential, testOptions);
3773
+ }
3774
+ `;
3765
3775
  const resolveDefaultFrameworkImport = (moduleDir)=>{
3766
3776
  const anchorDir = moduleDir ?? ('undefined' != typeof __dirname ? __dirname : void 0);
3767
3777
  const candidates = [
@@ -3850,6 +3860,37 @@ function createRstestYamlProject(options) {
3850
3860
  bail: options.bail
3851
3861
  };
3852
3862
  }
3863
+ if (1 === options.maxConcurrency) return {
3864
+ projectDir,
3865
+ outputDir,
3866
+ resultDir,
3867
+ include: [
3868
+ RSTEST_YAML_SEQUENTIAL_TEST_MODULE
3869
+ ],
3870
+ virtualModules: {
3871
+ [RSTEST_YAML_SEQUENTIAL_TEST_MODULE]: createGeneratedSequentialTestContent({
3872
+ rstestCoreImport,
3873
+ frameworkImport,
3874
+ testOptions: cases.map((item)=>({
3875
+ testName: item.testName,
3876
+ yamlFile: item.yamlFile,
3877
+ resultFile: item.resultFile,
3878
+ ...options.caseOptions?.[item.yamlFile] ? {
3879
+ caseOptions: options.caseOptions[item.yamlFile]
3880
+ } : {},
3881
+ ...options.webRuntimeOptions?.[item.yamlFile] ? {
3882
+ webRuntimeOptions: options.webRuntimeOptions[item.yamlFile]
3883
+ } : {}
3884
+ }))
3885
+ })
3886
+ },
3887
+ cases,
3888
+ sequentialTestModule: RSTEST_YAML_SEQUENTIAL_TEST_MODULE,
3889
+ maxConcurrency: 1,
3890
+ testTimeout,
3891
+ bail: options.bail,
3892
+ retry: options.retry
3893
+ };
3853
3894
  return {
3854
3895
  projectDir,
3855
3896
  outputDir,
@@ -3890,6 +3931,10 @@ const mapRunErrorsToCases = (project, result)=>{
3890
3931
  const addAll = (message)=>{
3891
3932
  for (const item of project.cases)add(item, message);
3892
3933
  };
3934
+ const matchesTestModule = (file, testModule)=>!!testModule && [
3935
+ file.name,
3936
+ file.testPath
3937
+ ].some((key)=>key === testModule || key?.includes(testModule));
3893
3938
  const matchFileCase = (file)=>{
3894
3939
  for (const key of [
3895
3940
  file.name,
@@ -3900,20 +3945,14 @@ const mapRunErrorsToCases = (project, result)=>{
3900
3945
  if (matched) return matched;
3901
3946
  }
3902
3947
  };
3903
- const isBatchFile = (file)=>{
3904
- if (!project.batchTest) return false;
3905
- for (const key of [
3906
- file.name,
3907
- file.testPath
3908
- ])if (key && (key === project.batchTest.testModule || key.includes(project.batchTest.testModule))) return true;
3909
- return false;
3910
- };
3948
+ const isBatchFile = (file)=>matchesTestModule(file, project.batchTest?.testModule);
3949
+ const isSequentialFile = (file)=>matchesTestModule(file, project.sequentialTestModule);
3911
3950
  const isBatchTest = (testName)=>testName === project.batchTest?.testName;
3912
3951
  for (const file of result.files ?? []){
3913
3952
  const fileCase = matchFileCase(file);
3914
3953
  for (const error of file.errors ?? []){
3915
3954
  const message = rstest_runner_errorMessage(error);
3916
- if (isBatchFile(file)) addAll(message);
3955
+ if (isBatchFile(file) || isSequentialFile(file)) addAll(message);
3917
3956
  else add(fileCase, message);
3918
3957
  }
3919
3958
  for (const testResult of file.results ?? []){