@@ -11,12 +11,13 @@ describe('Profiler Integration', () => {
1111 performance . clearMeasures ( ) ;
1212
1313 profiler = new Profiler ( {
14- prefix : 'test' ,
15- track : 'integration-tests' ,
16- color : 'primary' ,
14+ prefix : 'cp' ,
15+ track : 'CLI' ,
16+ trackGroup : 'Code Pushup' ,
17+ color : 'primary-dark' ,
1718 tracks : {
18- async : { track : 'async-ops ' , color : 'secondary ' } ,
19- sync : { track : 'sync-ops ' , color : 'tertiary ' } ,
19+ utils : { track : 'Utils ' , color : 'primary ' } ,
20+ core : { track : 'Core ' , color : 'primary-light ' } ,
2021 } ,
2122 enabled : true ,
2223 } ) ;
@@ -37,16 +38,29 @@ describe('Profiler Integration', () => {
3738
3839 expect ( marks ) . toStrictEqual (
3940 expect . arrayContaining ( [
40- expect . objectContaining ( { name : 'test:sync-test:start' } ) ,
41- expect . objectContaining ( { name : 'test:sync-test:end' } ) ,
41+ expect . objectContaining ( {
42+ name : 'cp:sync-test:start' ,
43+ detail : expect . objectContaining ( {
44+ devtools : expect . objectContaining ( { dataType : 'track-entry' } ) ,
45+ } ) ,
46+ } ) ,
47+ expect . objectContaining ( {
48+ name : 'cp:sync-test:end' ,
49+ detail : expect . objectContaining ( {
50+ devtools : expect . objectContaining ( { dataType : 'track-entry' } ) ,
51+ } ) ,
52+ } ) ,
4253 ] ) ,
4354 ) ;
4455
4556 expect ( measures ) . toStrictEqual (
4657 expect . arrayContaining ( [
4758 expect . objectContaining ( {
48- name : 'test :sync-test' ,
59+ name : 'cp :sync-test' ,
4960 duration : expect . any ( Number ) ,
61+ detail : expect . objectContaining ( {
62+ devtools : expect . objectContaining ( { dataType : 'track-entry' } ) ,
63+ } ) ,
5064 } ) ,
5165 ] ) ,
5266 ) ;
@@ -65,16 +79,29 @@ describe('Profiler Integration', () => {
6579
6680 expect ( marks ) . toStrictEqual (
6781 expect . arrayContaining ( [
68- expect . objectContaining ( { name : 'test:async-test:start' } ) ,
69- expect . objectContaining ( { name : 'test:async-test:end' } ) ,
82+ expect . objectContaining ( {
83+ name : 'cp:async-test:start' ,
84+ detail : expect . objectContaining ( {
85+ devtools : expect . objectContaining ( { dataType : 'track-entry' } ) ,
86+ } ) ,
87+ } ) ,
88+ expect . objectContaining ( {
89+ name : 'cp:async-test:end' ,
90+ detail : expect . objectContaining ( {
91+ devtools : expect . objectContaining ( { dataType : 'track-entry' } ) ,
92+ } ) ,
93+ } ) ,
7094 ] ) ,
7195 ) ;
7296
7397 expect ( measures ) . toStrictEqual (
7498 expect . arrayContaining ( [
7599 expect . objectContaining ( {
76- name : 'test :async-test' ,
100+ name : 'cp :async-test' ,
77101 duration : expect . any ( Number ) ,
102+ detail : expect . objectContaining ( {
103+ devtools : expect . objectContaining ( { dataType : 'track-entry' } ) ,
104+ } ) ,
78105 } ) ,
79106 ] ) ,
80107 ) ;
@@ -95,16 +122,16 @@ describe('Profiler Integration', () => {
95122 const markNames = marks . map ( m => m . name ) ;
96123 expect ( markNames ) . toStrictEqual (
97124 expect . arrayContaining ( [
98- 'test :outer:start' ,
99- 'test :outer:end' ,
100- 'test :inner:start' ,
101- 'test :inner:end' ,
125+ 'cp :outer:start' ,
126+ 'cp :outer:end' ,
127+ 'cp :inner:start' ,
128+ 'cp :inner:end' ,
102129 ] ) ,
103130 ) ;
104131
105132 const measureNames = measures . map ( m => m . name ) ;
106133 expect ( measureNames ) . toStrictEqual (
107- expect . arrayContaining ( [ 'test :outer' , 'test :inner' ] ) ,
134+ expect . arrayContaining ( [ 'cp :outer' , 'cp :inner' ] ) ,
108135 ) ;
109136 } ) ;
110137
@@ -151,11 +178,13 @@ describe('Profiler Integration', () => {
151178 expect ( measures ) . toStrictEqual (
152179 expect . arrayContaining ( [
153180 expect . objectContaining ( {
181+ name : 'cp:track-test' ,
154182 detail : {
155183 devtools : expect . objectContaining ( {
156184 dataType : 'track-entry' ,
157- track : 'integration-tests' ,
158- color : 'primary' ,
185+ track : 'CLI' ,
186+ trackGroup : 'Code Pushup' ,
187+ color : 'primary-dark' ,
159188 properties : [ [ 'result' , 'result' ] ] ,
160189 tooltipText : 'Track test completed' ,
161190 } ) ,
@@ -179,11 +208,13 @@ describe('Profiler Integration', () => {
179208 expect ( measures ) . toStrictEqual (
180209 expect . arrayContaining ( [
181210 expect . objectContaining ( {
211+ name : 'cp:sync-op' ,
182212 detail : {
183213 devtools : expect . objectContaining ( {
184214 dataType : 'track-entry' ,
185- track : 'integration-tests' ,
186- color : 'primary' ,
215+ track : 'CLI' ,
216+ trackGroup : 'Code Pushup' ,
217+ color : 'primary-dark' ,
187218 properties : [
188219 [ 'operation' , 'sync' ] ,
189220 [ 'result' , 'sync-result' ] ,
@@ -249,24 +280,18 @@ describe('Profiler Integration', () => {
249280 } ) ;
250281
251282 it ( 'should not create performance entries when disabled' , async ( ) => {
252- const disabledProfiler = new Profiler ( {
253- prefix : 'disabled' ,
254- track : 'disabled-tests' ,
255- color : 'primary' ,
256- tracks : { } ,
257- enabled : false ,
258- } ) ;
283+ profiler . setEnabled ( false ) ;
259284
260- const syncResult = disabledProfiler . measure ( 'disabled-sync' , ( ) => 'sync' ) ;
285+ const syncResult = profiler . measure ( 'disabled-sync' , ( ) => 'sync' ) ;
261286 expect ( syncResult ) . toBe ( 'sync' ) ;
262287
263- const asyncResult = disabledProfiler . measureAsync (
288+ const asyncResult = profiler . measureAsync (
264289 'disabled-async' ,
265290 async ( ) => 'async' ,
266291 ) ;
267292 await expect ( asyncResult ) . resolves . toBe ( 'async' ) ;
268293
269- disabledProfiler . marker ( 'disabled-marker' ) ;
294+ profiler . marker ( 'disabled-marker' ) ;
270295
271296 expect ( performance . getEntriesByType ( 'mark' ) ) . toHaveLength ( 0 ) ;
272297 expect ( performance . getEntriesByType ( 'measure' ) ) . toHaveLength ( 0 ) ;
0 commit comments