Skip to content

Commit

Permalink
Only match js files for prettier and fix style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
canova authored and julienw committed Nov 28, 2023
1 parent d8a1a67 commit 880a77a
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
},
},
{
files: 'bin/*',
files: 'bin/*.js',
options: {
// Files in bin/ are javascript files that may use Flow comments. We
// don't want the content of these Flow comments to be output outside of
Expand Down
5 changes: 2 additions & 3 deletions src/actions/profile-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1780,9 +1780,8 @@ export function changeInvertCallstack(
eventAction: 'change invert callstack',
});
const callTree = selectedThreadSelectors.getCallTree(getState());
const selectedCallNode = selectedThreadSelectors.getSelectedCallNodeIndex(
getState()
);
const selectedCallNode =
selectedThreadSelectors.getSelectedCallNodeIndex(getState());
const newSelectedCallNodePath =
callTree.findHeavyPathToSameFunctionAfterInversion(selectedCallNode);
dispatch({
Expand Down
5 changes: 2 additions & 3 deletions src/test/components/FlameGraph.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ describe('FlameGraph', function () {
const div = getContentDiv();

function selectedNode() {
const callNodeIndex = selectedThreadSelectors.getSelectedCallNodeIndex(
getState()
);
const callNodeIndex =
selectedThreadSelectors.getSelectedCallNodeIndex(getState());
return callNodeIndex && funcNames[callNodeIndex];
}

Expand Down
5 changes: 2 additions & 3 deletions src/test/components/NetworkChart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,8 @@ describe('Network Chart/tooltip behavior', () => {
afterEach(removeRootOverlayElement);

it('shows a tooltip when the mouse hovers the line', () => {
const { rowItem, queryByTestId, getByTestId } = setupWithPayload(
getNetworkMarkers()
);
const { rowItem, queryByTestId, getByTestId } =
setupWithPayload(getNetworkMarkers());

expect(queryByTestId('tooltip')).not.toBeInTheDocument();
// React uses mouseover/mouseout events to implement mouseenter/mouseleave.
Expand Down
20 changes: 8 additions & 12 deletions src/test/store/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,8 @@ describe('actions/changeInvertCallstack', function () {

it('starts with a selectedCallNodePath', function () {
const { getState } = storeWithNormalCallTree();
const { selectedCallNodePath, expandedCallNodePaths } = getPaths(
getState()
);
const { selectedCallNodePath, expandedCallNodePaths } =
getPaths(getState());
expect(selectedCallNodePath).toEqual(['A', 'B']);
expect(expandedCallNodePaths).toEqual([['A']]);
});
Expand All @@ -407,9 +406,8 @@ describe('actions/changeInvertCallstack', function () {
const { dispatch, getState } = storeWithProfile(profile);
dispatch(changeSelectedCallNode(threadIndex, callNodePath));
dispatch(changeInvertCallstack(true));
const { selectedCallNodePath, expandedCallNodePaths } = getPaths(
getState()
);
const { selectedCallNodePath, expandedCallNodePaths } =
getPaths(getState());

// Do not select the first alphabetical path:
expect(selectedCallNodePath).not.toEqual(['D', 'C', 'B']);
Expand All @@ -431,19 +429,17 @@ describe('actions/changeInvertCallstack', function () {

it('starts with a selectedCallNodePath', function () {
const { getState } = storeWithInvertedCallTree();
const { selectedCallNodePath, expandedCallNodePaths } = getPaths(
getState()
);
const { selectedCallNodePath, expandedCallNodePaths } =
getPaths(getState());
expect(selectedCallNodePath).toEqual(['J', 'I', 'B']);
expect(expandedCallNodePaths).toEqual([['J'], ['J', 'I']]);
});

it('uninverts the selectedCallNodePath', function () {
const { dispatch, getState } = storeWithInvertedCallTree();
dispatch(changeInvertCallstack(false));
const { selectedCallNodePath, expandedCallNodePaths } = getPaths(
getState()
);
const { selectedCallNodePath, expandedCallNodePaths } =
getPaths(getState());

expect(selectedCallNodePath).toEqual(['A', 'B']);
expect(expandedCallNodePaths).toEqual([['A']]);
Expand Down
5 changes: 2 additions & 3 deletions src/test/store/markers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,8 @@ describe('getTimelineVerticalMarkers', function () {
const getMarker = selectedThreadSelectors.getMarkerGetter(getState());
const markerIndexes =
selectedThreadSelectors.getTimelineVerticalMarkerIndexes(getState());
const allMarkers = selectedThreadSelectors.getFullMarkerListIndexes(
getState()
);
const allMarkers =
selectedThreadSelectors.getFullMarkerListIndexes(getState());

expect(allMarkers.length).toBeGreaterThan(markerIndexes.length);
expect(markerIndexes).toHaveLength(5);
Expand Down
40 changes: 16 additions & 24 deletions src/test/store/profile-view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -938,27 +938,24 @@ describe('actions/ProfileView', function () {
// Tests the filename, but with a substring
dispatch(ProfileView.changeMarkersSearchString('foo'));

markerIndexes = selectedThreadSelectors.getSearchFilteredMarkerIndexes(
getState()
);
markerIndexes =
selectedThreadSelectors.getSearchFilteredMarkerIndexes(getState());
expect(markerIndexes).toHaveLength(1);
expect(getMarker(markerIndexes[0]).name.includes('d')).toBeTruthy();

// Tests the operation
dispatch(ProfileView.changeMarkersSearchString('open'));

markerIndexes = selectedThreadSelectors.getSearchFilteredMarkerIndexes(
getState()
);
markerIndexes =
selectedThreadSelectors.getSearchFilteredMarkerIndexes(getState());
expect(markerIndexes).toHaveLength(1);
expect(getMarker(markerIndexes[0]).name.includes('d')).toBeTruthy();

// Tests the source
dispatch(ProfileView.changeMarkersSearchString('Interposer'));

markerIndexes = selectedThreadSelectors.getSearchFilteredMarkerIndexes(
getState()
);
markerIndexes =
selectedThreadSelectors.getSearchFilteredMarkerIndexes(getState());
expect(markerIndexes).toHaveLength(1);
expect(getMarker(markerIndexes[0]).name.includes('d')).toBeTruthy();
});
Expand Down Expand Up @@ -1033,17 +1030,15 @@ describe('actions/ProfileView', function () {
// Tests otherPid
dispatch(ProfileView.changeMarkersSearchString('3333'));

markerIndexes = selectedThreadSelectors.getSearchFilteredMarkerIndexes(
getState()
);
markerIndexes =
selectedThreadSelectors.getSearchFilteredMarkerIndexes(getState());
expect(markerIndexes).toHaveLength(1);
expect(getMarker(markerIndexes[0]).name.includes('IPCIn')).toBeTruthy();

dispatch(ProfileView.changeMarkersSearchString('9'));

markerIndexes = selectedThreadSelectors.getSearchFilteredMarkerIndexes(
getState()
);
markerIndexes =
selectedThreadSelectors.getSearchFilteredMarkerIndexes(getState());
expect(markerIndexes).toHaveLength(1);
expect(getMarker(markerIndexes[0]).name.includes('IPCOut')).toBeTruthy();
});
Expand Down Expand Up @@ -1160,18 +1155,16 @@ describe('actions/ProfileView', function () {
// Tests searching for the DOMEVent type
dispatch(ProfileView.changeMarkersSearchString('mouse'));

markerIndexes = selectedThreadSelectors.getSearchFilteredMarkerIndexes(
getState()
);
markerIndexes =
selectedThreadSelectors.getSearchFilteredMarkerIndexes(getState());
expect(markerIndexes).toHaveLength(1);
expect(getMarker(markerIndexes[0]).name.includes('a')).toBeTruthy();

// This tests searching in the category.
dispatch(ProfileView.changeMarkersSearchString('dom'));

markerIndexes = selectedThreadSelectors.getSearchFilteredMarkerIndexes(
getState()
);
markerIndexes =
selectedThreadSelectors.getSearchFilteredMarkerIndexes(getState());
expect(markerIndexes).toHaveLength(1);
expect(getMarker(markerIndexes[0]).name.includes('a')).toBeTruthy();
});
Expand Down Expand Up @@ -3291,9 +3284,8 @@ describe('traced timing', function () {
);
}

const { callNodeTable } = selectedThreadSelectors.getCallNodeInfo(
getState()
);
const { callNodeTable } =
selectedThreadSelectors.getCallNodeInfo(getState());

const { running, self } = ensureExists(
selectedThreadSelectors.getTracedTiming(getState()),
Expand Down
10 changes: 4 additions & 6 deletions src/test/store/receive-profile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1628,9 +1628,8 @@ describe('actions/receive-profile', function () {
expect(ZippedProfilesSelectors.getZipFileState(getState()).phase).toEqual(
'VIEW_PROFILE_IN_ZIP_FILE'
);
const errorMessage = ZippedProfilesSelectors.getZipFileErrorMessage(
getState()
);
const errorMessage =
ZippedProfilesSelectors.getZipFileErrorMessage(getState());
expect(errorMessage).toEqual(null);
});

Expand Down Expand Up @@ -1658,9 +1657,8 @@ describe('actions/receive-profile', function () {
expect(ZippedProfilesSelectors.getZipFileState(getState()).phase).toEqual(
'FAILED_TO_PROCESS_PROFILE_FROM_ZIP_FILE'
);
const errorMessage = ZippedProfilesSelectors.getZipFileErrorMessage(
getState()
);
const errorMessage =
ZippedProfilesSelectors.getZipFileErrorMessage(getState());
expect(typeof errorMessage).toEqual('string');
expect(errorMessage).toMatchSnapshot();
});
Expand Down
20 changes: 8 additions & 12 deletions src/test/store/transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1206,9 +1206,8 @@ describe('"collapse-direct-recursion" transform', function () {
it('keeps the line number and address of the innermost frame', function () {
const { dispatch, getState } = storeWithProfile(profile);
dispatch(addTransformToStack(threadIndex, collapseDirectRecursion));
const filteredThread = selectedThreadSelectors.getFilteredThread(
getState()
);
const filteredThread =
selectedThreadSelectors.getFilteredThread(getState());
const { stackTable, frameTable, funcTable, samples, stringTable } =
filteredThread;
const fileStringIndex = stringTable.indexForString('b');
Expand Down Expand Up @@ -1390,9 +1389,8 @@ describe('"collapse-recursion" transform', function () {
it('keeps the line number and address of the innermost frame', function () {
const { dispatch, getState } = storeWithProfile(profile);
dispatch(addTransformToStack(threadIndex, collapseRecursion));
const filteredThread = selectedThreadSelectors.getFilteredThread(
getState()
);
const filteredThread =
selectedThreadSelectors.getFilteredThread(getState());
const { stackTable, frameTable, funcTable, samples, stringTable } =
filteredThread;
const fileStringIndex = stringTable.indexForString('b');
Expand Down Expand Up @@ -1503,9 +1501,8 @@ describe('"collapse-recursion" transform', function () {
it('keeps the line number and address of the innermost frame', function () {
const { dispatch, getState } = storeWithProfile(profile);
dispatch(addTransformToStack(threadIndex, collapseRecursion));
const filteredThread = selectedThreadSelectors.getFilteredThread(
getState()
);
const filteredThread =
selectedThreadSelectors.getFilteredThread(getState());
const { stackTable, frameTable, funcTable, samples, stringTable } =
filteredThread;
const fileStringIndex = stringTable.indexForString('b');
Expand Down Expand Up @@ -1639,9 +1636,8 @@ describe('"collapse-recursion" transform', function () {
it('keeps the line number and address of the innermost frame', function () {
const { dispatch, getState } = storeWithProfile(profile);
dispatch(addTransformToStack(threadIndex, collapseRecursion));
const filteredThread = selectedThreadSelectors.getFilteredThread(
getState()
);
const filteredThread =
selectedThreadSelectors.getFilteredThread(getState());
const { stackTable, frameTable, funcTable, samples, stringTable } =
filteredThread;
const fileStringIndex = stringTable.indexForString('b');
Expand Down
5 changes: 2 additions & 3 deletions src/test/store/zipped-profiles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ describe('selected and expanded zip files', function () {
...zipFileTree.getAllDescendants(null),
])
);
const expanded = ZippedProfilesSelectors.getExpandedZipFileIndexes(
getState()
);
const expanded =
ZippedProfilesSelectors.getExpandedZipFileIndexes(getState());
const expandedNames = expanded.map(
(index) => zipFileTable.path[ensureExists(index)]
);
Expand Down
40 changes: 16 additions & 24 deletions src/test/url-handling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,8 @@ describe('url handling tracks', function () {
'localTrackOrderByPid=222-10'
);

const previousOrder = urlStateSelectors.getLocalTrackOrderByPid(
getState()
);
const previousOrder =
urlStateSelectors.getLocalTrackOrderByPid(getState());
// This simulates a page reload.
const storeAfterReload = _getStoreFromStateAfterUrlRoundtrip(getState());
expect(
Expand Down Expand Up @@ -743,9 +742,8 @@ describe('committed ranges', function () {
search: '?range=1678123900n100',
});

const [committedRange] = urlStateSelectors.getAllCommittedRanges(
getState()
);
const [committedRange] =
urlStateSelectors.getAllCommittedRanges(getState());
expect(committedRange.start).toBeCloseTo(1678.1239);
expect(committedRange.end).toBeCloseTo(1678.124);
});
Expand Down Expand Up @@ -1221,9 +1219,8 @@ describe('url upgrading', function () {
const { getState } = _getStoreWithURL({
v: 4,
});
const committedRanges = urlStateSelectors.getAllCommittedRanges(
getState()
);
const committedRanges =
urlStateSelectors.getAllCommittedRanges(getState());
expect(committedRanges).toEqual([]);
});

Expand All @@ -1233,9 +1230,8 @@ describe('url upgrading', function () {
v: 4,
});

const committedRanges = urlStateSelectors.getAllCommittedRanges(
getState()
);
const committedRanges =
urlStateSelectors.getAllCommittedRanges(getState());
expect(committedRanges).toEqual([{ start: 1451, end: 1453 }]);
});

Expand All @@ -1245,9 +1241,8 @@ describe('url upgrading', function () {
v: 4,
});

const committedRanges = urlStateSelectors.getAllCommittedRanges(
getState()
);
const committedRanges =
urlStateSelectors.getAllCommittedRanges(getState());
expect(committedRanges).toEqual([
{ start: 245, end: 18470 },
{ start: 1451, end: 1453 },
Expand All @@ -1260,9 +1255,8 @@ describe('url upgrading', function () {
v: 4,
});

const committedRanges = urlStateSelectors.getAllCommittedRanges(
getState()
);
const committedRanges =
urlStateSelectors.getAllCommittedRanges(getState());
expect(committedRanges).toEqual([{ start: 0, end: 278 }]);
});

Expand All @@ -1275,9 +1269,8 @@ describe('url upgrading', function () {
v: 4,
});

const committedRanges = urlStateSelectors.getAllCommittedRanges(
getState()
);
const committedRanges =
urlStateSelectors.getAllCommittedRanges(getState());
expect(committedRanges).toEqual([{ start: 1451, end: 1453 }]);
expect(console.error).toHaveBeenCalled();
});
Expand Down Expand Up @@ -1437,9 +1430,8 @@ describe('URL serialization of the transform stack', function () {
});

it('deserializes focus subtree transforms', function () {
const transformStack = selectedThreadSelectors.getTransformStack(
getState()
);
const transformStack =
selectedThreadSelectors.getTransformStack(getState());

// The indexes don't necessarily map to anything logical in the profile fixture.
expect(transformStack).toEqual([
Expand Down

0 comments on commit 880a77a

Please sign in to comment.