diff --git a/.babelrc b/.babelrc deleted file mode 100644 index aa1bd21..0000000 --- a/.babelrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "presets": [ - [ - "react-app", - { "absoluteRuntime": false, "flow": true, "typescript": false } - ] - ] -} diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..6640bf9 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + ['react-app', {absoluteRuntime: false, flow: true, typescript: false}], + ], +}; diff --git a/jest.config.js b/jest.config.js index 30e44cb..4f08d90 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,4 +2,8 @@ module.exports = { moduleNameMapper: { '\\.css$': 'identity-obj-proxy', }, + transformIgnorePatterns: [ + // Pass @elg/speedscope through transforms + '/node_modules/(?!@elg/speedscope).+\\.js$', + ], }; diff --git a/src/util/__tests__/__snapshots__/preprocessData-test.js.snap b/src/util/__tests__/__snapshots__/preprocessData-test.js.snap index 411d547..0546645 100644 --- a/src/util/__tests__/__snapshots__/preprocessData-test.js.snap +++ b/src/util/__tests__/__snapshots__/preprocessData-test.js.snap @@ -573,6 +573,17 @@ Object { "type": "suspense-resolved", }, ], + "flamechart": Flamechart { + "layers": Array [], + "minFrameWidth": 1, + "source": Object { + "forEachCall": [Function], + "formatValue": [Function], + "getColorBucketForFrame": [Function], + "getTotalWeight": [Function], + }, + "totalWeight": -8993778496, + }, "measures": Array [ Object { "batchUID": 0, @@ -1276,6 +1287,17 @@ Object { "type": "schedule-force-update", }, ], + "flamechart": Flamechart { + "layers": Array [], + "minFrameWidth": 1, + "source": Object { + "forEachCall": [Function], + "formatValue": [Function], + "getColorBucketForFrame": [Function], + "getTotalWeight": [Function], + }, + "totalWeight": -40806924876, + }, "measures": Array [ Object { "batchUID": 0, diff --git a/src/util/__tests__/preprocessData-test.js b/src/util/__tests__/preprocessData-test.js index aee183c..30e5481 100644 --- a/src/util/__tests__/preprocessData-test.js +++ b/src/util/__tests__/preprocessData-test.js @@ -50,27 +50,17 @@ describe(getLanesFromTransportDecimalBitmask, () => { }); describe(preprocessData, () => { - it('should return empty data given an empty timeline', () => { - expect(preprocessData([])).toEqual({ - startTime: 0, - duration: 0, - events: [], - measures: [], - }); + it('should throw given an empty timeline', () => { + expect(() => preprocessData([])).toThrow(); }); - it('should return empty data given a timeline with no Profile event', () => { - expect( + it('should throw given a timeline with no Profile event', () => { + expect(() => // prettier-ignore preprocessData([ {"args":{"data":{"navigationId":"43BC238A4FB7548146D3CD739C9C9434"}},"cat":"blink.user_timing","name":"--schedule-render-512-","ph":"R","pid":9312,"tid":10252,"ts":8994056569,"tts":1816966}, ]), - ).toEqual({ - startTime: 0, - duration: 0, - events: [], - measures: [], - }); + ).toThrow(); }); it('should return empty data given a timeline with no React scheduling profiling marks', () => { @@ -85,11 +75,13 @@ describe(preprocessData, () => { {"pid":57632,"tid":38659,"ts":874860756224,"ph":"X","cat":"disabled-by-default-devtools.timeline","name":"RunTask","dur":7,"tdur":6,"tts":8700285008,"args":{}}, {"pid":57632,"tid":38659,"ts":874860756233,"ph":"X","cat":"disabled-by-default-devtools.timeline","name":"RunTask","dur":5,"tdur":4,"tts":8700285017,"args":{}}, ]), - ).toEqual({ + ).toMatchObject({ startTime: 8993778496, duration: 865866977.737, events: [], measures: [], + // TODO: Change expectation back to toEqual and test for empty flamechart + // when custom flamechart type is added. }); });