@@ -22,6 +22,10 @@ import {
2222} from "../../test/vitest/vitest.unit-fast-paths.mjs" ;
2323import { boundaryTestFiles , isUnitConfigTestFile } from "../../test/vitest/vitest.unit-paths.mjs" ;
2424import { listTrackedTestFiles } from "./list-test-files.mts" ;
25+ import {
26+ resolveVitestPretestBuildMode ,
27+ type VitestPretestBuildMode as NodeTestPretestBuildMode ,
28+ } from "./vitest-build-prerequisites.mts" ;
2529
2630type NodeTestShardGroup = {
2731 shard_name : string ;
@@ -58,15 +62,6 @@ type NodeTestPlanOptions = {
5862} ;
5963
6064type CompactNodeTestPlanMode = "pull-request" | "push" ;
61- type NodeTestPretestBuildMode = "private-qa" | "runtime" ;
62-
63- const PRETEST_RUNTIME_BUILD_FILES = new Set ( [
64- "test/e2e/qa-lab/runtime/gateway-support-export-runtime.test.ts" ,
65- ] ) ;
66-
67- function resolvePretestBuildMode ( paths : readonly string [ ] ) : NodeTestPretestBuildMode | undefined {
68- return paths . some ( ( file ) => PRETEST_RUNTIME_BUILD_FILES . has ( file ) ) ? "runtime" : undefined ;
69- }
7065
7166type PolicyTestWatch = {
7267 ownerGlobs ?: readonly string [ ] ;
@@ -137,7 +132,7 @@ type CompactNodeTestShard = Omit<NodeTestShard, "configs" | "groups"> & {
137132 groups : NodeTestShardGroup [ ] ;
138133} ;
139134
140- type NodeTestSplitShard = Omit < NodeTestShard , "checkName" | "runner" > & {
135+ type NodeTestSplitShard = Omit < NodeTestShard , "checkName" | "runner" | "pretestBuildMode" > & {
141136 includeExternalConfigs ?: boolean ;
142137 runner ?: string ;
143138} ;
@@ -1588,19 +1583,12 @@ function createToolingSplitShards(): NodeTestSplitShard[] {
15881583 listCompactToolingTestFiles ( ) ,
15891584 COMPACT_TOOLING_NODE_TEST_GROUPS ,
15901585 stripeFileWeight ,
1591- ) . map ( ( includePatterns , index ) => {
1592- const pretestBuildMode = resolvePretestBuildMode ( includePatterns ) ;
1593- const shard : NodeTestSplitShard = {
1594- shardName : `core-tooling-${ index + 1 } ` ,
1595- configs : [ TOOLING_CONFIG ] ,
1596- includePatterns,
1597- requiresDist : false ,
1598- } ;
1599- if ( pretestBuildMode ) {
1600- shard . pretestBuildMode = pretestBuildMode ;
1601- }
1602- return shard ;
1603- } ) ,
1586+ ) . map ( ( includePatterns , index ) => ( {
1587+ shardName : `core-tooling-${ index + 1 } ` ,
1588+ configs : [ TOOLING_CONFIG ] ,
1589+ includePatterns,
1590+ requiresDist : false ,
1591+ } ) ) ,
16041592 {
16051593 shardName : "core-tooling-isolated" ,
16061594 configs : [ "test/vitest/vitest.tooling-docker.config.ts" , TOOLING_ISOLATED_CONFIG ] ,
@@ -1908,28 +1896,32 @@ export function createNodeTestShards(options: NodeTestPlanOptions = {}): NodeTes
19081896 return [ ] ;
19091897 }
19101898
1899+ const pretestBuildMode = resolveVitestPretestBuildMode ( [
1900+ { configs : splitConfigs , includePatterns : splitShard . includePatterns } ,
1901+ ] ) ;
1902+
19111903 return [
19121904 {
19131905 checkName : formatNodeTestShardCheckName ( splitShard . shardName ) ,
19141906 shardName : splitShard . shardName ,
19151907 configs : splitConfigs ,
19161908 ...( splitShard . env ? { env : splitShard . env } : { } ) ,
19171909 ...( splitShard . includePatterns ? { includePatterns : splitShard . includePatterns } : { } ) ,
1918- ...( splitShard . pretestBuildMode
1919- ? { pretestBuildMode : splitShard . pretestBuildMode }
1920- : { } ) ,
1910+ ...( pretestBuildMode ? { pretestBuildMode } : { } ) ,
19211911 runner : splitShard . runner ?? DEFAULT_NODE_TEST_RUNNER ,
19221912 requiresDist : splitShard . requiresDist ,
19231913 } ,
19241914 ] ;
19251915 } ) ;
19261916 }
19271917
1918+ const pretestBuildMode = resolveVitestPretestBuildMode ( [ { configs } ] ) ;
19281919 return [
19291920 {
19301921 checkName : formatNodeTestShardCheckName ( shard . name ) ,
19311922 shardName : shard . name ,
19321923 configs,
1924+ ...( pretestBuildMode ? { pretestBuildMode } : { } ) ,
19331925 runner : DEFAULT_NODE_TEST_RUNNER ,
19341926 requiresDist : DIST_DEPENDENT_NODE_SHARD_NAMES . has ( shard . name ) ,
19351927 } ,
0 commit comments