@@ -9,14 +9,13 @@ const sinon = require('sinon')
99describe ( 'profilers/native/wall' , ( ) => {
1010 let NativeWallProfiler
1111 let pprof
12- let stop
1312
1413 beforeEach ( ( ) => {
15- stop = sinon . stub ( ) . returns ( 'profile' )
1614 pprof = {
1715 encode : sinon . stub ( ) . returns ( Promise . resolve ( ) ) ,
1816 time : {
19- start : sinon . stub ( ) . returns ( stop )
17+ start : sinon . stub ( ) ,
18+ stop : sinon . stub ( ) . returns ( 'profile' )
2019 }
2120 }
2221
@@ -45,24 +44,35 @@ describe('profilers/native/wall', () => {
4544 process . _stopProfilerIdleNotifier = stop
4645
4746 sinon . assert . calledOnce ( pprof . time . start )
48- sinon . assert . calledWith ( pprof . time . start , 1e6 / 99 )
47+ sinon . assert . calledWith ( pprof . time . start ,
48+ { intervalMicros : 1e6 / 99 ,
49+ durationMillis : 60000 ,
50+ sourceMapper : undefined ,
51+ customLabels : false ,
52+ lineNumbers : false } )
4953 } )
5054
5155 it ( 'should use the provided configuration options' , ( ) => {
5256 const samplingInterval = 500
5357 const profiler = new NativeWallProfiler ( { samplingInterval } )
5458
5559 profiler . start ( )
60+ profiler . stop ( )
5661
57- sinon . assert . calledWith ( pprof . time . start , samplingInterval )
62+ sinon . assert . calledWith ( pprof . time . start ,
63+ { intervalMicros : 500 ,
64+ durationMillis : 60000 ,
65+ sourceMapper : undefined ,
66+ customLabels : false ,
67+ lineNumbers : false } )
5868 } )
5969
6070 it ( 'should not stop when not started' , ( ) => {
6171 const profiler = new NativeWallProfiler ( )
6272
6373 profiler . stop ( )
6474
65- sinon . assert . notCalled ( stop )
75+ sinon . assert . notCalled ( pprof . time . stop )
6676 } )
6777
6878 it ( 'should stop the internal time profiler' , ( ) => {
@@ -71,7 +81,7 @@ describe('profilers/native/wall', () => {
7181 profiler . start ( )
7282 profiler . stop ( )
7383
74- sinon . assert . calledOnce ( stop )
84+ sinon . assert . calledOnce ( pprof . time . stop )
7585 } )
7686
7787 it ( 'should stop the internal time profiler only once' , ( ) => {
@@ -81,7 +91,7 @@ describe('profilers/native/wall', () => {
8191 profiler . stop ( )
8292 profiler . stop ( )
8393
84- sinon . assert . calledOnce ( stop )
94+ sinon . assert . calledOnce ( pprof . time . stop )
8595 } )
8696
8797 it ( 'should collect profiles from the internal time profiler' , ( ) => {
@@ -93,8 +103,9 @@ describe('profilers/native/wall', () => {
93103
94104 expect ( profile ) . to . equal ( 'profile' )
95105
96- sinon . assert . calledOnce ( stop )
106+ sinon . assert . calledOnce ( pprof . time . stop )
97107 sinon . assert . calledOnce ( pprof . time . start )
108+ profiler . stop ( )
98109 } )
99110
100111 it ( 'should encode profiles from the pprof time profiler' , ( ) => {
@@ -106,6 +117,8 @@ describe('profilers/native/wall', () => {
106117
107118 profiler . encode ( profile )
108119
120+ profiler . stop ( )
121+
109122 sinon . assert . calledOnce ( pprof . encode )
110123 } )
111124
@@ -115,7 +128,13 @@ describe('profilers/native/wall', () => {
115128 const mapper = { }
116129
117130 profiler . start ( { mapper } )
131+ profiler . stop ( )
118132
119- sinon . assert . calledWith ( pprof . time . start , 1e6 / 99 , null , mapper , false )
133+ sinon . assert . calledWith ( pprof . time . start ,
134+ { intervalMicros : 1e6 / 99 ,
135+ durationMillis : 60000 ,
136+ sourceMapper : mapper ,
137+ customLabels : false ,
138+ lineNumbers : false } )
120139 } )
121140} )
0 commit comments