@@ -94,7 +94,12 @@ const isMacMiniProfile = testProfile === "macmini";
9494// Preserve OPENCLAW_TEST_VM_FORKS=1 as the explicit override/debug escape hatch.
9595const supportsVmForks = Number . isFinite ( nodeMajor ) ? nodeMajor <= 24 : true ;
9696const useVmForks = process . env . OPENCLAW_TEST_VM_FORKS === "1" && supportsVmForks ;
97- const disableIsolation = process . env . OPENCLAW_TEST_NO_ISOLATE === "1" ;
97+ const forceIsolation =
98+ process . env . OPENCLAW_TEST_ISOLATE === "1" || process . env . OPENCLAW_TEST_ISOLATE === "true" ;
99+ const disableIsolation =
100+ ! forceIsolation &&
101+ process . env . OPENCLAW_TEST_NO_ISOLATE !== "0" &&
102+ process . env . OPENCLAW_TEST_NO_ISOLATE !== "false" ;
98103const includeGatewaySuite = process . env . OPENCLAW_TEST_INCLUDE_GATEWAY === "1" ;
99104const includeExtensionsSuite = process . env . OPENCLAW_TEST_INCLUDE_EXTENSIONS === "1" ;
100105// Even on low-memory hosts, keep the isolated lane split so files like
@@ -699,10 +704,40 @@ const createTargetedEntry = (owner, isolated, filters) => {
699704 ] ,
700705 } ;
701706} ;
707+ const formatPerFileEntryName = ( owner , file ) => {
708+ const baseName = path
709+ . basename ( file )
710+ . replace ( / \. l i v e \. t e s t \. t s $ / u, "" )
711+ . replace ( / \. e 2 e \. t e s t \. t s $ / u, "" )
712+ . replace ( / \. t e s t \. t s $ / u, "" ) ;
713+ return `${ owner } -${ baseName } ` ;
714+ } ;
715+ const createPerFileTargetedEntry = ( file ) => {
716+ const target = inferTarget ( file ) ;
717+ const owner = isThreadSingletonUnitFile ( file )
718+ ? "unit-threads"
719+ : isVmForkSingletonUnitFile ( file )
720+ ? "unit-vmforks"
721+ : target . owner ;
722+ return {
723+ ...createTargetedEntry ( owner , target . isolated , [ file ] ) ,
724+ name : formatPerFileEntryName ( owner , file ) ,
725+ } ;
726+ } ;
702727const targetedEntries = ( ( ) => {
703728 if ( passthroughFileFilters . length === 0 ) {
704729 return [ ] ;
705730 }
731+ if ( disableIsolation ) {
732+ const matchedFiles = passthroughFileFilters . flatMap ( ( fileFilter ) => {
733+ const resolved = resolveFilterMatches ( fileFilter ) ;
734+ if ( resolved . length > 0 ) {
735+ return resolved ;
736+ }
737+ return [ normalizeRepoPath ( fileFilter ) ] ;
738+ } ) ;
739+ return [ ...new Set ( matchedFiles ) ] . map ( ( file ) => createPerFileTargetedEntry ( file ) ) ;
740+ }
706741 const groups = passthroughFileFilters . reduce ( ( acc , fileFilter ) => {
707742 const matchedFiles = resolveFilterMatches ( fileFilter ) ;
708743 if ( matchedFiles . length === 0 ) {
@@ -738,15 +773,27 @@ const targetedEntries = (() => {
738773 return createTargetedEntry ( owner , mode === "isolated" , [ ...new Set ( filters ) ] ) ;
739774 } ) ;
740775} ) ( ) ;
776+ if ( disableIsolation && passthroughFileFilters . length === 0 ) {
777+ runs = allKnownUnitFiles . map ( ( file ) => createPerFileTargetedEntry ( file ) ) ;
778+ }
741779// Node 25 local runs still show cross-process worker shutdown contention even
742780// after moving the known heavy files into singleton lanes.
743781const topLevelParallelEnabled =
744782 testProfile !== "low" &&
745783 testProfile !== "serial" &&
746784 ! ( ! isCI && nodeMajor >= 25 ) &&
747785 ! isMacMiniProfile ;
748- const defaultTopLevelParallelLimit =
749- testProfile === "serial"
786+ const defaultTopLevelParallelLimit = disableIsolation
787+ ? isCI
788+ ? isWindows
789+ ? 2
790+ : 4
791+ : highMemLocalHost
792+ ? Math . min ( 16 , hostCpuCount )
793+ : lowMemLocalHost
794+ ? Math . min ( 8 , hostCpuCount )
795+ : Math . min ( 12 , hostCpuCount )
796+ : testProfile === "serial"
750797 ? 1
751798 : testProfile === "low"
752799 ? lowMemLocalHost
0 commit comments