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

deps(jest): upgrade to 27.0.3 #12454

Merged
merged 8 commits into from
Jun 2, 2021
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
14 changes: 9 additions & 5 deletions clients/test/lightrider-entry-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,21 @@ describe('lightrider-entry', () => {
runStub.mockRestore();
});

let originalRun;
Copy link
Collaborator Author

@connorjclark connorjclark May 7, 2021

Choose a reason for hiding this comment

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

jestjs/jest#9828 disallowed these functions from being nested in a test case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh dang yeah, I did not expect that to work haha

beforeEach(() => {
originalRun = Runner.run;
});
afterEach(() => {
Runner.run = originalRun;
});

it('exposes artifacts when logAssets is true', async () => {
const originalRun = Runner.run;
Runner.run = jest.fn().mockReturnValue(Promise.resolve({
Runner.run = jest.fn(Runner.run).mockReturnValue(Promise.resolve({
lhr: {},
artifacts: {
Artifact: new Error('some error'),
},
}));
afterEach(() => {
Runner.run = originalRun;
});

const mockConnection = {};
const url = 'https://example.com';
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ module.exports = {
'**/docs/**/*.test.js',
],
transform: {},
prettierPath: null,
};
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ describe('ReportUIFeatures', () => {
global.I18n = undefined;
global.ReportUIFeatures = undefined;
global.matchMedia = undefined;
global.self.matchMedia = undefined;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I.... have no idea how this was working ... but I am extremely curious.

maybe before global.self === global and now it does not? In Chrome self === globalThis.self, so circular global object references makes some sort of sense, but maybe Jest decided to remove that behavior for global.

global.CriticalRequestChainRenderer = undefined;
global.DetailsRenderer = undefined;
global.CategoryRenderer = undefined;
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-treemap/test/treemap-test-pptr.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Lighthouse Treemap', () => {

afterAll(async function() {
await Promise.all([
new Promise(resolve => server.close(resolve)),
server.close(),
browser && browser.close(),
]);
});
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-viewer/test/viewer-test-pptr.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('Lighthouse Viewer', () => {
if (pageErrors.length > 0) console.error(pageErrors);

await Promise.all([
new Promise(resolve => server.close(resolve)),
server.close(),
Copy link
Collaborator Author

@connorjclark connorjclark May 7, 2021

Choose a reason for hiding this comment

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

Another brainteaser!

server.close doesn't take any parameters. This file is not typechecked, so this wasn't caught. If this were a raw http.Server object, it would work as written. This mistake happened because of the StaticServer refactor.

The brainteaser is... why did this ever work? I suppose before, Jest simply gave up at some point and shutdown. But now it will fail if afterPass hangs.

browser && browser.close(),
]);
});
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"glob": "^7.1.3",
"idb-keyval": "2.2.0",
"intl-messageformat-parser": "^1.8.1",
"jest": "^26.6.1",
"jest": "^27.0.3",
"jsdom": "^12.2.0",
"jsonld": "^5.2.0",
"jsonlint-mod": "^1.7.6",
Expand All @@ -150,7 +150,6 @@
"npm-run-posix-or-windows": "^2.0.2",
"package-json-versionify": "^1.0.4",
"pako": "^2.0.3",
"prettier": "^1.14.3",
"pretty-json-stringify": "^0.0.2",
"puppeteer": "^9.1.1",
"tabulator-tables": "^4.9.3",
Expand Down
Loading