@@ -30,10 +30,17 @@ function getOrScheduleUpdatePromise () {
3030}
3131
3232describe ( 'FuzzyFinder' , ( ) => {
33+ let disposable , reporterStub
3334 let rootDir1 , rootDir2
3435 let fuzzyFinder , projectView , bufferView , gitStatusView , workspaceElement , fixturesPath
3536
3637 beforeEach ( async ( ) => {
38+ reporterStub = {
39+ addTiming : sinon . spy ( ) ,
40+ incrementCounter : ( ) => { }
41+ }
42+ disposable = fuzzyFinderPackage . consumeMetricsReporter ( reporterStub )
43+
3744 const ancestorDir = fs . realpathSync ( temp . mkdirSync ( ) )
3845 rootDir1 = path . join ( ancestorDir , 'root-dir1' )
3946 rootDir2 = path . join ( ancestorDir , 'root-dir2' )
@@ -66,6 +73,12 @@ describe('FuzzyFinder', () => {
6673 jasmine . useRealClock ( )
6774 } )
6875
76+ afterEach ( ( ) => {
77+ if ( disposable ) {
78+ disposable . dispose ( )
79+ }
80+ } )
81+
6982 async function waitForPathsToDisplay ( fuzzyFinderView ) {
7083 return conditionPromise ( ( ) => fuzzyFinderView . element . querySelectorAll ( 'li' ) . length > 0 )
7184 }
@@ -1658,21 +1671,7 @@ describe('FuzzyFinder', () => {
16581671 } )
16591672
16601673 describe ( 'logging of metrics events' , ( ) => {
1661- let disposable
1662-
1663- afterEach ( ( ) => {
1664- if ( disposable ) {
1665- disposable . dispose ( )
1666- }
1667- } )
1668-
16691674 it ( 'logs the crawling time' , async ( ) => {
1670- const reporterStub = {
1671- addTiming : sinon . spy ( )
1672- }
1673-
1674- disposable = fuzzyFinderPackage . consumeMetricsReporter ( reporterStub )
1675-
16761675 // After setting the reporter it may receive some old events from previous tests
16771676 // that we want to discard.
16781677 reporterStub . addTiming . reset ( )
@@ -1688,10 +1687,6 @@ describe('FuzzyFinder', () => {
16881687 } )
16891688
16901689 it ( 'queues the events until a reporter is set' , async ( ) => {
1691- const reporterStub = {
1692- addTiming : sinon . spy ( )
1693- }
1694-
16951690 // After setting the reporter it may receive some old events from previous tests
16961691 // that we want to discard.
16971692 reporterStub . addTiming . reset ( )
0 commit comments