Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Jest and other test-related libraries #1212

Merged
merged 2 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.4.1",
"babel-jest": "^23.4.2",
"babel-loader": "^7.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
Expand All @@ -82,9 +82,9 @@
"css-loader": "^0.28.9",
"devtools-license-check": "^0.6.0",
"docsify-cli": "^4.2.1",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme-to-json": "^3.3.1",
"enzyme": "^3.4.4",
"enzyme-adapter-react-16": "^1.2.0",
"enzyme-to-json": "^3.3.4",
"eslint": "^4.12.0",
"eslint-config-prettier": "^2.4.0",
"eslint-plugin-babel": "^4.1.2",
Expand All @@ -102,14 +102,14 @@
"html-webpack-plugin": "^3.2.0",
"http-server": "^0.11.1",
"husky": "^0.14.3",
"jest": "^22.4.2",
"jest": "^23.5.0",
"json-loader": "^0.5.7",
"local-web-server": "^2.4.0",
"mkdirp": "^0.5.1",
"npm-run-all": "^4.1.2",
"prettier": "^1.10.2",
"raw-loader": "^0.5.1",
"react-test-renderer": "^16.2.0",
"react-test-renderer": "^16.4.2",
"rimraf": "^2.6.2",
"sinon": "^4.3.0",
"style-loader": "^0.20.1",
Expand Down
8 changes: 4 additions & 4 deletions src/test/components/__snapshots__/Details.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ exports[`app/Details show the correct state for the sidebar open button 2`] = `
<TabBar
extraElements={
<button
className="sidebar-open-close-button photon-button photon-button-ghost sidebar-open-close-button-isclosed"
className="sidebar-open-close-button photon-button photon-button-ghost sidebar-open-close-button-isopen"
onClick={[Function]}
title="Open the sidebar"
title="Close the sidebar"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AH the new snapshots are actually what's expected -- this means the tests weren't working properly before :/

Copy link
Contributor Author

@julienw julienw Aug 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is enzymejs/enzyme#1499 -- and this is a good thing !

Before this we had to call "update" everywhere (I just forgot to do it here). I'm gonna remove them all then ! I can't remove the call to update anywhere else because this is only for shallow and not for mount yet (maybe later ?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops.

type="button"
/>
}
Expand Down Expand Up @@ -545,7 +545,7 @@ exports[`app/Details show the correct state for the sidebar open button 3`] = `
}
onChangeTabOrder={[Function]}
onSelectTab={[Function]}
selectedTabName="calltree"
selectedTabName="flame-graph"
tabOrder={
Array [
0,
Expand Down Expand Up @@ -585,7 +585,7 @@ exports[`app/Details show the correct state for the sidebar open button 3`] = `
]
}
/>
<ProfileCallTreeView />
<FlameGraphView />
<Connect(CallNodeContextMenu) />
<Connect(MarkersContextMenu) />
<Connect(TimelineTrackContextMenu) />
Expand Down
1 change: 0 additions & 1 deletion src/test/components/__snapshots__/Home.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ exports[`app/Home renders the install screen for the legacy add-on 1`] = `
To start recording a performance profile in Firefox, first install the

<a
className={undefined}
Copy link
Contributor Author

@julienw julienw Aug 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like that when a prop has an undefined value it's not output in snapshots anymore, which seems reasonnable.
This is jestjs/jest#6162

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cleaner.

href="https://raw.githubusercontent.com/devtools-html/Gecko-Profiler-Addon/master/gecko_profiler_legacy.xpi"
onClick={[Function]}
>
Expand Down
30 changes: 30 additions & 0 deletions src/test/components/__snapshots__/MarkerChart.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ Array [
"rgba(255, 255, 255, 0.0)",
],
],
"results": Array [
Object {
"isThrow": false,
"value": undefined,
},
Object {
"isThrow": false,
"value": undefined,
},
],
Copy link
Contributor Author

@julienw julienw Aug 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mock functions now track results in addition to parameters, that's why we see it in the serialized version too.

Looking at this snapshot, it looks like that addColorStop could be just a jest.fn() instead of a full spyLog in https://github.com/devtools-html/perf.html/blob/87eb4c73b3e75eea24c82e8f7950142402bd905b/src/test/fixtures/mocks/canvas-context.js#L38-L40
Indeed the data seems to be duplicated: we see both the calls to addColorStop above and the mock serialization.

What do you think ? I could do it directly in this PR or in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine however you want to do it.

},
},
],
Expand Down Expand Up @@ -576,6 +586,16 @@ Array [
"rgba(255, 255, 255, 0.0)",
],
],
"results": Array [
Object {
"isThrow": false,
"value": undefined,
},
Object {
"isThrow": false,
"value": undefined,
},
],
},
},
],
Expand Down Expand Up @@ -880,6 +900,16 @@ Array [
"rgba(255, 255, 255, 0.0)",
],
],
"results": Array [
Object {
"isThrow": false,
"value": undefined,
},
Object {
"isThrow": false,
"value": undefined,
},
],
},
},
],
Expand Down
18 changes: 6 additions & 12 deletions src/test/components/__snapshots__/MenuButtons.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 1`] = `
className="menuButtonsPermalinkTextField"
readOnly="readOnly"
type="text"
value="about:blank"
value="http://localhost/"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like window.location has a better default value now, see jestjs/jest#6792

/>
</div>
</div>
Expand Down Expand Up @@ -271,7 +271,6 @@ exports[`app/MenuButtons renders the MenuButtons buttons 1`] = `
checked={false}
className="menuButtonsShareNetworkUrlsCheckbox"
disabled={true}
onChange={undefined}
type="checkbox"
/>
Share the URLs of all network requests
Expand Down Expand Up @@ -490,7 +489,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 2`] = `
className="menuButtonsPermalinkTextField"
readOnly="readOnly"
type="text"
value="about:blank"
value="http://localhost/"
/>
</div>
</div>
Expand Down Expand Up @@ -616,7 +615,6 @@ exports[`app/MenuButtons renders the MenuButtons buttons 2`] = `
checked={false}
className="menuButtonsShareNetworkUrlsCheckbox"
disabled={true}
onChange={undefined}
type="checkbox"
/>
Share the URLs of all network requests
Expand Down Expand Up @@ -835,7 +833,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo
className="menuButtonsPermalinkTextField"
readOnly="readOnly"
type="text"
value="about:blank"
value="http://localhost/"
/>
</div>
</div>
Expand Down Expand Up @@ -961,7 +959,6 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo
checked={false}
className="menuButtonsShareNetworkUrlsCheckbox"
disabled={true}
onChange={undefined}
type="checkbox"
/>
Share the URLs of all network requests
Expand Down Expand Up @@ -1180,7 +1177,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo
className="menuButtonsPermalinkTextField"
readOnly="readOnly"
type="text"
value="about:blank"
value="http://localhost/"
/>
</div>
</div>
Expand Down Expand Up @@ -1306,7 +1303,6 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo
checked={false}
className="menuButtonsShareNetworkUrlsCheckbox"
disabled={true}
onChange={undefined}
type="checkbox"
/>
Share the URLs of all network requests
Expand Down Expand Up @@ -1525,7 +1521,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo
className="menuButtonsPermalinkTextField"
readOnly="readOnly"
type="text"
value="about:blank"
value="http://localhost/"
/>
</div>
</div>
Expand Down Expand Up @@ -1651,7 +1647,6 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo
checked={false}
className="menuButtonsShareNetworkUrlsCheckbox"
disabled={true}
onChange={undefined}
type="checkbox"
/>
Share the URLs of all network requests
Expand Down Expand Up @@ -1870,7 +1865,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo
className="menuButtonsPermalinkTextField"
readOnly="readOnly"
type="text"
value="about:blank"
value="http://localhost/"
/>
</div>
</div>
Expand Down Expand Up @@ -1996,7 +1991,6 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo
checked={false}
className="menuButtonsShareNetworkUrlsCheckbox"
disabled={true}
onChange={undefined}
type="checkbox"
/>
Share the URLs of all network requests
Expand Down
4 changes: 0 additions & 4 deletions src/test/components/__snapshots__/Timeline.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ exports[`Timeline renders the header 1`] = `
>
<li
className="timelineTrack"
style={undefined}
>
<div
className="timelineTrackRow timelineTrackGlobalRow"
Expand Down Expand Up @@ -148,7 +147,6 @@ exports[`Timeline renders the header 1`] = `
>
<li
className="timelineTrack timelineTrackLocal"
style={undefined}
>
<div
className="timelineTrackRow timelineTrackLocalRow selected"
Expand Down Expand Up @@ -205,7 +203,6 @@ process: \\"default\\" (0)"
</li>
<li
className="timelineTrack timelineTrackLocal"
style={undefined}
>
<div
className="timelineTrackRow timelineTrackLocalRow"
Expand Down Expand Up @@ -296,7 +293,6 @@ process: \\"default\\" (0)"
</li>
<li
className="timelineTrack timelineTrackLocal"
style={undefined}
>
<div
className="timelineTrackRow timelineTrackLocalRow"
Expand Down
6 changes: 3 additions & 3 deletions src/test/components/__snapshots__/ZipFileTree.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ exports[`calltree/ZipFileTree renders a zip file tree 1`] = `
className="treeViewRowColumn treeViewMainColumn name"
>
<a
href="null/from-url//calltree/?file=foo%2Fbar%2Fprofile1.json"
Copy link
Contributor Author

@julienw julienw Aug 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again the window.location change :)

href="http://localhost/from-url//calltree/?file=foo%2Fbar%2Fprofile1.json"
onClick={[Function]}
>
profile1.json
Expand Down Expand Up @@ -254,7 +254,7 @@ exports[`calltree/ZipFileTree renders a zip file tree 1`] = `
className="treeViewRowColumn treeViewMainColumn name"
>
<a
href="null/from-url//calltree/?file=foo%2Fprofile2.json"
href="http://localhost/from-url//calltree/?file=foo%2Fprofile2.json"
onClick={[Function]}
>
profile2.json
Expand Down Expand Up @@ -313,7 +313,7 @@ exports[`calltree/ZipFileTree renders a zip file tree 1`] = `
className="treeViewRowColumn treeViewMainColumn name"
>
<a
href="null/from-url//calltree/?file=baz%2Fprofile3.json"
href="http://localhost/from-url//calltree/?file=baz%2Fprofile3.json"
onClick={[Function]}
>
profile3.json
Expand Down
Loading