File tree 3 files changed +15
-3
lines changed
packages/vscode-js-profile-core/src/cpu
3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ module.exports = {
16
16
rules : {
17
17
'@typescript-eslint/no-use-before-define' : 'off' ,
18
18
'@typescript-eslint/explicit-function-return-type' : 'off' ,
19
- '@typescript-eslint/interface-name-prefix' : [ 'error' , { prefixWithI : 'always' } ] ,
20
19
'react/display-name' : 'off' ,
21
20
'react/prop-types' : 'off' ,
22
21
'header/header' : [
Original file line number Diff line number Diff line change @@ -11,6 +11,17 @@ describe('model', () => {
11
11
expect ( buildModel ( profiles [ i ] ) ) . toMatchSnapshot ( ) ;
12
12
} ) ;
13
13
}
14
+
15
+ it ( 'does not error on empty, profile' , ( ) => {
16
+ buildModel ( {
17
+ nodes : [ ] ,
18
+ samples : [ ] ,
19
+ timeDeltas : [ ] ,
20
+ startTime : 1654100488066000 ,
21
+ endTime : 1654100490779000 ,
22
+ $vscode : { rootPath : '.' , locations : [ ] } ,
23
+ } ) ;
24
+ } ) ;
14
25
} ) ;
15
26
16
27
const profiles = [
Original file line number Diff line number Diff line change @@ -229,8 +229,10 @@ export const buildModel = (profile: ICpuProfileRaw): IProfileModel => {
229
229
// time before the first sample, and the time of the last sample is only
230
230
// derived (approximately) by the missing time in the sum of deltas. Save
231
231
// some work by calculating it here.
232
- nodes [ mapId ( samples [ timeDeltas . length - 1 ] ) ] . selfTime += lastNodeTime ;
233
- timeDeltas . push ( lastNodeTime ) ;
232
+ if ( nodes . length ) {
233
+ nodes [ mapId ( samples [ timeDeltas . length - 1 ] ) ] . selfTime += lastNodeTime ;
234
+ timeDeltas . push ( lastNodeTime ) ;
235
+ }
234
236
235
237
// 3. Add the aggregate times for all node children and locations
236
238
for ( let i = 0 ; i < nodes . length ; i ++ ) {
You can’t perform that action at this time.
0 commit comments