File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2562,6 +2562,9 @@ describe("check pipeline", () => {
25622562 expect ( reached ?. message ) . toMatch (
25632563 / ^ C h e c k r e a c h e d i t s - - b u d g e t o f 7 0 s w h i l e r u n n i n g t h e o v e r l a p p a s s .* S e c o n d s p e r p h a s e : / ,
25642564 ) ;
2565+ expect ( trackCheckReport ) . toHaveBeenCalledWith (
2566+ expect . objectContaining ( { ok : false , stopCode : "check_budget_reached" } ) ,
2567+ ) ;
25652568 expect ( report . ok ) . toBe ( false ) ;
25662569 expect ( report . layout . findings . some ( ( finding ) => finding . code === "container_overflow" ) ) . toBe (
25672570 true ,
@@ -3626,6 +3629,7 @@ describe("check report telemetry", () => {
36263629 } ) ,
36273630 ) ;
36283631 expect ( report . contrast . errorCount ) . toBe ( 1 ) ;
3632+ expect ( trackCheckReport . mock . calls [ 0 ] ?. [ 0 ] . stopCode ) . toBeUndefined ( ) ;
36293633 } ) ;
36303634
36313635 it ( "reports zero browser samples and timings after a lint short circuit" , async ( ) => {
Original file line number Diff line number Diff line change @@ -167,6 +167,46 @@ describe("trackCheckReport", () => {
167167 } ) ;
168168 } ) ;
169169
170+ it ( "names the finding that stopped the check, and omits it when none did" , ( ) => {
171+ const props = {
172+ contrastGate : false ,
173+ motionGate : false ,
174+ captionZoneGate : false ,
175+ frameCheckGate : false ,
176+ snapshotsGate : false ,
177+ lintErrors : 0 ,
178+ lintWarnings : 0 ,
179+ runtimeErrors : 1 ,
180+ runtimeWarnings : 0 ,
181+ layoutErrors : 0 ,
182+ layoutWarnings : 0 ,
183+ motionErrors : 0 ,
184+ motionWarnings : 0 ,
185+ contrastErrors : 0 ,
186+ contrastWarnings : 0 ,
187+ craftWarnings : 0 ,
188+ launchSettleMs : 0 ,
189+ renderReadyTimedOut : false ,
190+ seekLoopMs : 0 ,
191+ contrastMs : 0 ,
192+ gridMs : 0 ,
193+ craftMs : 0 ,
194+ overlapMs : 0 ,
195+ durationSec : 0 ,
196+ gridPoints : 0 ,
197+ contrastPoints : 0 ,
198+ ok : false ,
199+ exitCode : 1 ,
200+ } ;
201+ trackCheckReport ( { ...props , stopCode : "media_copies_unfinished" } ) ;
202+ expect ( trackEvent ) . toHaveBeenLastCalledWith (
203+ "check_report" ,
204+ expect . objectContaining ( { stop_code : "media_copies_unfinished" } ) ,
205+ ) ;
206+ trackCheckReport ( props ) ;
207+ expect ( trackEvent . mock . calls . at ( - 1 ) ?. [ 1 ] ) . not . toHaveProperty ( "stop_code" ) ;
208+ } ) ;
209+
170210 it ( "omits run_id when no run ID is provided" , ( ) => {
171211 trackCheckReport ( {
172212 contrastGate : false ,
Original file line number Diff line number Diff line change @@ -1193,6 +1193,8 @@ export function trackCheckReport(props: {
11931193 contrastPoints : number ;
11941194 ok : boolean ;
11951195 exitCode : number ;
1196+ /** The code of the finding that stopped the check, one of a closed set (checkPipeline's STOP_CODES). */
1197+ stopCode ?: string ;
11961198 runId ?: string ;
11971199} ) : void {
11981200 trackEvent ( "check_report" , {
@@ -1224,6 +1226,7 @@ export function trackCheckReport(props: {
12241226 contrast_points : props . contrastPoints ,
12251227 ok : props . ok ,
12261228 exit_code : props . exitCode ,
1229+ ...( props . stopCode && { stop_code : props . stopCode } ) ,
12271230 ...runIdField ( props . runId ) ,
12281231 } ) ;
12291232}
Original file line number Diff line number Diff line change @@ -2130,6 +2130,7 @@ function buildReport(
21302130 contrastPoints : browser . contrastChecked ,
21312131 ok : report . ok ,
21322132 exitCode : checkExitCode ( report ) ,
2133+ stopCode : browser . runtimeFindings . find ( ( finding ) => STOP_CODES . has ( finding . code ) ) ?. code ,
21332134 runId : getRunId ( ) ,
21342135 } ) ;
21352136 return filterComponentReport ( report , options ) ;
@@ -2264,6 +2265,13 @@ function emptyBrowserResult(): CheckBrowserResult {
22642265 } ;
22652266}
22662267
2268+ /** The codes `runtimeFailure` gives a finding that ends the browser check early; `check_report` sends the first one. */
2269+ const STOP_CODES : ReadonlySet < string > = new Set ( [
2270+ "media_copies_unfinished" ,
2271+ "check_budget_reached" ,
2272+ "check_runtime_failure" ,
2273+ ] ) ;
2274+
22672275function runtimeFailure ( error : unknown , code ?: string ) : CheckFinding {
22682276 return findingAtRoot (
22692277 code ??
You can’t perform that action at this time.
0 commit comments