@@ -10,7 +10,7 @@ import { beforeEach, afterEach } from "mocha";
1010import { Workspace } from "../../workspace" ;
1111
1212import { FAKE_TELEMETRY } from "./fakeTelemetry" ;
13- import { createContext , FakeContext } from "./helpers" ;
13+ import { createContext , FakeContext , retryForDuration } from "./helpers" ;
1414
1515suite ( "Workspace" , ( ) => {
1616 let workspacePath : string ;
@@ -56,13 +56,13 @@ suite("Workspace", () => {
5656 fs . rmSync ( path . join ( gitDir , "rebase-apply" ) ) ;
5757 }
5858
59- // Give enough time for all watchers to fire and all debounces to run off
60- await new Promise ( ( resolve ) => setTimeout ( resolve , 10000 ) ) ;
61-
62- // The start call only happens once because of the inhibitRestart flag
63- assert . strictEqual ( startStub . callCount , 1 ) ;
64- // The restart call only happens once because of the debounce
65- assert . strictEqual ( restartSpy . callCount , 1 ) ;
59+ // Retry assertions for up to 30 seconds to allow watchers and debounces to fire
60+ await retryForDuration ( 30000 , ( ) => {
61+ // The start call only happens once because of the inhibitRestart flag
62+ assert . strictEqual ( startStub . callCount , 1 ) ;
63+ // The restart call only happens once because of the debounce
64+ assert . strictEqual ( restartSpy . callCount , 1 ) ;
65+ } ) ;
6666 } ) . timeout ( 60000 ) ;
6767
6868 test ( "does not restart when watched files are touched without modifying contents" , async ( ) => {
0 commit comments