11import type { ContinuousThreadCpuProfile , ThreadCpuProfile } from '@sentry/core' ;
22import { CpuProfilerBindings , PrivateCpuProfilerBindings } from '../src/cpu_profiler' ;
3- import type { RawThreadCpuProfile } from '../src/types' ;
3+ import { ProfileFormat , RawThreadCpuProfile } from '../src/types' ;
44
55// Required because we test a hypothetical long profile
66// and we cannot use advance timers as the c++ relies on
@@ -19,10 +19,10 @@ const fibonacci = (n: number): number => {
1919} ;
2020
2121const wait = ( ms : number ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
22- const profiled = async ( name : string , fn : ( ) => void , format : 0 | 1 = 0 ) => {
22+ const profiled = async ( name : string , fn : ( ) => void ) => {
2323 CpuProfilerBindings . startProfiling ( name ) ;
2424 await fn ( ) ;
25- return CpuProfilerBindings . stopProfiling ( name , format ) ;
25+ return CpuProfilerBindings . stopProfiling ( name , ProfileFormat . THREAD ) ;
2626} ;
2727
2828const assertValidSamplesAndStacks = (
@@ -216,15 +216,15 @@ describe('Profiler bindings', () => {
216216 } ) ;
217217
218218 it ( 'chunk format type' , async ( ) => {
219- const profile = await profiled (
220- 'non nullable stack' ,
221- async ( ) => {
222- await wait ( 1000 ) ;
223- fibonacci ( 36 ) ;
224- await wait ( 1000 ) ;
225- } ,
226- 1 ,
227- ) ;
219+ const fn = async ( ) => {
220+ await wait ( 1000 ) ;
221+ fibonacci ( 36 ) ;
222+ await wait ( 1000 ) ;
223+ } ;
224+
225+ CpuProfilerBindings . startProfiling ( 'non nullable stack' ) ;
226+ await fn ( ) ;
227+ const profile = CpuProfilerBindings . stopProfiling ( 'non nullable stack' , ProfileFormat . CHUNK ) ;
228228
229229 if ( ! profile ) fail ( 'Profile is null' ) ;
230230
0 commit comments