@@ -3991,50 +3991,6 @@ it("applies transition sample limits within the requested range", async () => {
39913991 expect ( report . layout . transitionSamplesDropped ) . toBe ( 3 ) ;
39923992} ) ;
39933993
3994- describe ( "check stopped by a signal" , ( ) => {
3995- it ( "SIGTERM prints the report so far, then exits 143" , async ( ) => {
3996- const { deps, runBrowserCheck } = dependencies ( fakeDriver ( ) ) ;
3997- const reachedBrowser = new Promise < void > ( ( resolve ) => {
3998- runBrowserCheck . mockImplementation ( ( ) => {
3999- resolve ( ) ;
4000- return new Promise < CheckBrowserResult > ( ( ) => undefined ) ;
4001- } ) ;
4002- } ) ;
4003- const order : string [ ] = [ ] ;
4004- registerRootExitRequester ( ( code ) => order . push ( `exit ${ code } ` ) ) ;
4005- const log = vi . spyOn ( console , "log" ) . mockImplementation ( ( line ) => {
4006- order . push ( `print ${ String ( line ) . slice ( 0 , 1 ) } ` ) ;
4007- } ) ;
4008- const command = createCheckCommand ( {
4009- resolveProject : ( ) => PROJECT ,
4010- runPipeline : ( project , options ) => runCheckPipeline ( project , options , deps ) ,
4011- prepareMedia : vi . fn ( async ( ) => [ ] ) ,
4012- withMeta : ( value ) => value ,
4013- } ) ;
4014-
4015- const running = runCommand ( command , { rawArgs : [ "--json" ] } ) ;
4016- await reachedBrowser ;
4017- process . emit ( "SIGTERM" ) ;
4018- await running ;
4019- await vi . waitFor ( ( ) => expect ( order ) . toContain ( "exit 143" ) ) ;
4020-
4021- const report = JSON . parse ( String ( log . mock . calls [ 0 ] ?. [ 0 ] ) ) ;
4022- expect ( report . ok ) . toBe ( false ) ;
4023- expect ( report . runtime . findings . map ( ( finding : CheckFinding ) => finding . message ) ) . toContain (
4024- "Check stopped before finishing (SIGTERM)." ,
4025- ) ;
4026- expect ( order ) . toEqual ( [ "print {" , "exit 143" ] ) ;
4027- } ) ;
4028- } ) ;
4029-
4030- describe ( "check --lint-verbose" , ( ) => {
4031- it ( "is a known flag, as render, preview and publish spell it, and a made-up one still is not" , ( ) => {
4032- const check = createCheckCommand ( ) as never ;
4033- expect ( ( ) => assertKnownFlags ( check , [ "--lint-verbose" , "--json" ] , "check" ) ) . not . toThrow ( ) ;
4034- expect ( ( ) => assertKnownFlags ( check , [ "--lint-loud" ] , "check" ) ) . toThrow ( "Unknown flag" ) ;
4035- } ) ;
4036- } ) ;
4037-
40383994describe ( "check cache" , ( ) => {
40393995 const dirs : string [ ] = [ ] ;
40403996 afterEach ( ( ) => {
@@ -4098,3 +4054,46 @@ describe("check cache", () => {
40984054 expect ( runPipeline ) . toHaveBeenCalledTimes ( 4 ) ;
40994055 } ) ;
41004056} ) ;
4057+ describe ( "check stopped by a signal" , ( ) => {
4058+ it ( "SIGTERM prints the report so far, then exits 143" , async ( ) => {
4059+ const { deps, runBrowserCheck } = dependencies ( fakeDriver ( ) ) ;
4060+ const reachedBrowser = new Promise < void > ( ( resolve ) => {
4061+ runBrowserCheck . mockImplementation ( ( ) => {
4062+ resolve ( ) ;
4063+ return new Promise < CheckBrowserResult > ( ( ) => undefined ) ;
4064+ } ) ;
4065+ } ) ;
4066+ const order : string [ ] = [ ] ;
4067+ registerRootExitRequester ( ( code ) => order . push ( `exit ${ code } ` ) ) ;
4068+ const log = vi . spyOn ( console , "log" ) . mockImplementation ( ( line ) => {
4069+ order . push ( `print ${ String ( line ) . slice ( 0 , 1 ) } ` ) ;
4070+ } ) ;
4071+ const command = createCheckCommand ( {
4072+ resolveProject : ( ) => PROJECT ,
4073+ runPipeline : ( project , options ) => runCheckPipeline ( project , options , deps ) ,
4074+ prepareMedia : vi . fn ( async ( ) => [ ] ) ,
4075+ withMeta : ( value ) => value ,
4076+ } ) ;
4077+
4078+ const running = runCommand ( command , { rawArgs : [ "--json" ] } ) ;
4079+ await reachedBrowser ;
4080+ process . emit ( "SIGTERM" ) ;
4081+ await running ;
4082+ await vi . waitFor ( ( ) => expect ( order ) . toContain ( "exit 143" ) ) ;
4083+
4084+ const report = JSON . parse ( String ( log . mock . calls [ 0 ] ?. [ 0 ] ) ) ;
4085+ expect ( report . ok ) . toBe ( false ) ;
4086+ expect ( report . runtime . findings . map ( ( finding : CheckFinding ) => finding . message ) ) . toContain (
4087+ "Check stopped before finishing (SIGTERM)." ,
4088+ ) ;
4089+ expect ( order ) . toEqual ( [ "print {" , "exit 143" ] ) ;
4090+ } ) ;
4091+ } ) ;
4092+
4093+ describe ( "check --lint-verbose" , ( ) => {
4094+ it ( "is a known flag, as render, preview and publish spell it, and a made-up one still is not" , ( ) => {
4095+ const check = createCheckCommand ( ) as never ;
4096+ expect ( ( ) => assertKnownFlags ( check , [ "--lint-verbose" , "--json" ] , "check" ) ) . not . toThrow ( ) ;
4097+ expect ( ( ) => assertKnownFlags ( check , [ "--lint-loud" ] , "check" ) ) . toThrow ( "Unknown flag" ) ;
4098+ } ) ;
4099+ } ) ;
0 commit comments