@@ -8,7 +8,8 @@ export type WatchProjectGroup = 'demo' | 'apps'
88export type ConcreteWatchCaseName = 'taro' | 'uni' | 'mpx' | 'rax' | 'mina' | 'weapp-vite' | 'uni-app-vue3-vite' | 'uni-app-tailwindcss-v4' | 'taro-vite-tailwindcss-v4' | 'taro-app-vite' | 'taro-webpack-tailwindcss-v4' | 'taro-vue3-app' | 'taro-webpack' | 'vite-native-ts'
99export type WatchCaseName = ConcreteWatchCaseName | 'both' | 'all' | 'demo' | 'apps'
1010type MutationKind = 'template' | 'script' | 'style'
11- type MutationRoundName = 'baseline-arbitrary' | 'complex-corpus'
11+ type MutationRoundName = 'baseline-arbitrary' | 'complex-corpus' | 'hex-arbitrary'
12+ const REQUIRED_MUTATION_ROUNDS : MutationRoundName [ ] = [ 'baseline-arbitrary' , 'complex-corpus' , 'hex-arbitrary' ]
1213
1314interface MutationRoundReport {
1415 roundName : MutationRoundName
@@ -313,8 +314,9 @@ async function runWatchHmrCommand(cwd: string, args: string[], commandTimeoutMs:
313314function assertHotUpdateReport ( report : HotUpdateReport , target : WatchCaseName , maxHotUpdateMs : number ) {
314315 expect ( report . summary . count ) . toBeGreaterThan ( 0 )
315316 expect ( report . cases . length ) . toBe ( report . summary . count )
316- expect ( report . summaryByRound [ 'baseline-arbitrary' ] ?. count ) . toBe ( report . summary . count )
317- expect ( report . summaryByRound [ 'complex-corpus' ] ?. count ) . toBe ( report . summary . count )
317+ for ( const roundName of REQUIRED_MUTATION_ROUNDS ) {
318+ expect ( report . summaryByRound [ roundName ] ?. count ) . toBe ( report . summary . count )
319+ }
318320 expect ( report . summaryByMutationKind . template ?. count ) . toBe ( report . summary . count )
319321 expect ( report . summaryByMutationKind . script ?. count ) . toBe ( report . summary . count )
320322 expect ( report . summaryByMutationKind . style ?. count ) . toBe ( report . summary . count )
@@ -339,7 +341,7 @@ function assertHotUpdateReport(report: HotUpdateReport, target: WatchCaseName, m
339341 expect ( item . rollbackEffectiveMs ) . toBeGreaterThan ( 0 )
340342 expect ( item . classTokens . length ) . toBeGreaterThanOrEqual ( 12 )
341343 expect ( item . escapedClasses . length ) . toBe ( item . classTokens . length )
342- expect ( item . rounds . length ) . toBe ( 2 )
344+ expect ( item . rounds . length ) . toBeGreaterThanOrEqual ( REQUIRED_MUTATION_ROUNDS . length )
343345 expect ( item . mutationMetrics . length ) . toBe ( 3 )
344346 expect ( item . summaryByMutationKind . template ?. count ) . toBe ( 1 )
345347 expect ( item . summaryByMutationKind . script ?. count ) . toBe ( 1 )
@@ -354,12 +356,18 @@ function assertHotUpdateReport(report: HotUpdateReport, target: WatchCaseName, m
354356
355357 const baselineRound = item . rounds . find ( round => round . roundName === 'baseline-arbitrary' )
356358 const complexRound = item . rounds . find ( round => round . roundName === 'complex-corpus' )
359+ const hexRound = item . rounds . find ( round => round . roundName === 'hex-arbitrary' )
357360 expect ( baselineRound ) . toBeDefined ( )
358361 expect ( complexRound ) . toBeDefined ( )
362+ expect ( hexRound ) . toBeDefined ( )
359363 expect ( baselineRound ?. classTokens . length ) . toBeGreaterThanOrEqual ( 7 )
360364 expect ( complexRound ?. classTokens . length ) . toBeGreaterThanOrEqual ( 12 )
365+ expect ( hexRound ?. classTokens . length ) . toBeGreaterThanOrEqual ( 5 )
366+ expect ( hexRound ?. classTokens . some ( token => token . startsWith ( 'bg-[#' ) ) ) . toBe ( true )
361367 expect ( complexRound ?. hotUpdateEffectiveMs ) . toBeGreaterThan ( 0 )
362368 expect ( complexRound ?. rollbackEffectiveMs ) . toBeGreaterThan ( 0 )
369+ expect ( hexRound ?. hotUpdateEffectiveMs ) . toBeGreaterThan ( 0 )
370+ expect ( hexRound ?. rollbackEffectiveMs ) . toBeGreaterThan ( 0 )
363371 expect ( item . roundComparison ) . toBeDefined ( )
364372 expect ( item . roundComparison ?. hotUpdateRatio ) . toBeGreaterThan ( 0 )
365373 expect ( item . roundComparison ?. rollbackRatio ) . toBeGreaterThan ( 0 )
@@ -395,7 +403,10 @@ function assertHotUpdateReport(report: HotUpdateReport, target: WatchCaseName, m
395403 expect ( scriptMetric ?. hotUpdateEffectiveMs ) . toBeLessThanOrEqual ( maxHotUpdateMs )
396404
397405 if ( templateMetric && templateMetric . mutationKind !== 'style' ) {
398- expect ( templateMetric . rounds . length ) . toBe ( 2 )
406+ expect ( templateMetric . rounds . length ) . toBeGreaterThanOrEqual ( REQUIRED_MUTATION_ROUNDS . length )
407+ for ( const roundName of REQUIRED_MUTATION_ROUNDS ) {
408+ expect ( templateMetric . rounds . some ( round => round . roundName === roundName ) ) . toBe ( true )
409+ }
399410 expect ( templateMetric . verifiedGlobalStyleEscapedClasses . length ) . toBeGreaterThanOrEqual ( templateMetric . minRequiredGlobalStyleEscapedClasses )
400411 assertHasWxssOutput (
401412 normalizeGlobalStyleOutputs ( templateMetric . globalStyleOutputs ?? templateMetric . globalStyleOutput ) ,
@@ -404,7 +415,10 @@ function assertHotUpdateReport(report: HotUpdateReport, target: WatchCaseName, m
404415 }
405416
406417 if ( scriptMetric && scriptMetric . mutationKind !== 'style' ) {
407- expect ( scriptMetric . rounds . length ) . toBe ( 2 )
418+ expect ( scriptMetric . rounds . length ) . toBeGreaterThanOrEqual ( REQUIRED_MUTATION_ROUNDS . length )
419+ for ( const roundName of REQUIRED_MUTATION_ROUNDS ) {
420+ expect ( scriptMetric . rounds . some ( round => round . roundName === roundName ) ) . toBe ( true )
421+ }
408422 expect ( scriptMetric . verifiedGlobalStyleEscapedClasses . length ) . toBeGreaterThanOrEqual ( scriptMetric . minRequiredGlobalStyleEscapedClasses )
409423 assertHasWxssOutput (
410424 normalizeGlobalStyleOutputs ( scriptMetric . globalStyleOutputs ?? scriptMetric . globalStyleOutput ) ,
0 commit comments