@@ -56,15 +56,38 @@ describeChromeOnly('Tracing', function () {
56
56
it ( 'should run with custom categories if provided' , async ( ) => {
57
57
await page . tracing . start ( {
58
58
path : outputFile ,
59
- categories : [ 'disabled-by-default-v8.cpu_profiler.hires' ] ,
59
+ categories : [ '-*' , ' disabled-by-default-v8.cpu_profiler.hires'] ,
60
60
} ) ;
61
61
await page . tracing . stop ( ) ;
62
62
63
63
const traceJson = JSON . parse (
64
64
fs . readFileSync ( outputFile , { encoding : 'utf8' } )
65
65
) ;
66
- expect ( traceJson . metadata [ 'trace-config' ] ) . toContain (
67
- 'disabled-by-default-v8.cpu_profiler.hires'
66
+ const traceConfig = JSON . parse ( traceJson . metadata [ 'trace-config' ] ) ;
67
+ expect ( traceConfig . included_categories ) . toEqual ( [
68
+ 'disabled-by-default-v8.cpu_profiler.hires' ,
69
+ ] ) ;
70
+ expect ( traceConfig . excluded_categories ) . toEqual ( [ '*' ] ) ;
71
+ expect ( traceJson . traceEvents ) . not . toContainEqual (
72
+ expect . objectContaining ( {
73
+ cat : 'toplevel' ,
74
+ } )
75
+ ) ;
76
+ } ) ;
77
+
78
+ it ( 'should run with default categories' , async ( ) => {
79
+ await page . tracing . start ( {
80
+ path : outputFile ,
81
+ } ) ;
82
+ await page . tracing . stop ( ) ;
83
+
84
+ const traceJson = JSON . parse (
85
+ fs . readFileSync ( outputFile , { encoding : 'utf8' } )
86
+ ) ;
87
+ expect ( traceJson . traceEvents ) . toContainEqual (
88
+ expect . objectContaining ( {
89
+ cat : 'toplevel' ,
90
+ } )
68
91
) ;
69
92
} ) ;
70
93
it ( 'should throw if tracing on two pages' , async ( ) => {
0 commit comments