@@ -12,7 +12,6 @@ describe("login", () => {
1212 // Create a new context with the saved storage state
1313 const storageState = JSON . parse ( process . env . STORAGE || "" )
1414
15- //
1615 const cookieToStore = {
1716 sameSite : "Lax" as const ,
1817 name : "key" ,
@@ -61,16 +60,20 @@ describe("login", () => {
6160
6261 // NOTE: this test will fail if you do not run code-server with --home $CODE_SERVER_ADDRESS/healthz
6362 it ( "should see a 'Go Home' button in the Application Menu that goes to /healthz" , async ( done ) => {
63+ let requestedGoHomeUrl = false
6464 // Ideally, this test should pass and finish before the timeout set in the Jest config
6565 // However, if it doesn't, we don't want a memory leak so we set this backup timeout
6666 // Otherwise Jest may throw this error
6767 // "Jest did not exit one second after the test run has completed.
6868 // This usually means that there are asynchronous operations that weren't stopped in your tests.
6969 // Consider running Jest with `--detectOpenHandles` to troubleshoot this issue."
70- const backupTimeout = setTimeout ( ( ) => done ( ) , 20000 )
70+ const backupTimeout = setTimeout ( ( ) => {
71+ // If it's not true by this point then the test should fail
72+ expect ( requestedGoHomeUrl ) . toBeTruthy ( )
73+ done ( )
74+ } , 20000 )
7175
7276 const GO_HOME_URL = `${ process . env . CODE_SERVER_ADDRESS } /healthz`
73- let requestedGoHomeUrl = false
7477 page . on ( "request" , ( request ) => {
7578 // This ensures that we did make a request to the GO_HOME_URL
7679 // Most reliable way to test button
0 commit comments