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 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions clients/test/lightrider-entry-test.js
Expand Up @@ -119,17 +119,21 @@ describe('lightrider-entry', () => {
runStub.mockRestore();
});

let originalRun;
Copy link
Collaborator Author

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
Expand Up @@ -32,4 +32,5 @@ module.exports = {
'**/docs/**/*.test.js',
],
transform: {},
prettierPath: null,
};
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-viewer/test/viewer-test-pptr.js
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

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
Expand Up @@ -138,14 +138,13 @@
"glob": "^7.1.3",
"idb-keyval": "2.2.0",
"intl-messageformat-parser": "^1.8.1",
"jest": "^26.6.1",
"jest": "^27.0.0-next.9",
"jsdom": "^12.2.0",
"lighthouse-plugin-publisher-ads": "^1.3.0",
"lodash.clonedeep": "^4.5.0",
"node-fetch": "^2.6.1",
"npm-run-posix-or-windows": "^2.0.2",
"package-json-versionify": "^1.0.4",
"prettier": "^1.14.3",
"pretty-json-stringify": "^0.0.2",
"puppeteer": "^1.19.0",
"tabulator-tables": "^4.9.3",
Expand Down