Jest update v26.6.3 -> v29.5.1

Summary:
^

Basically, update Jest and fix any raised issues. Mainly:
- Update necessary dependencies
- Update snapshots
- `useFakeTimers` caused a few issues which meant that the way we hook into the performance object had to be tweaked. The main code change is: `//fbsource/xplat/sonar/desktop/scripts/jest-setup-after.tsx`
- `mocked` -> `jest.mocked`

Changelog: Update Jest to v29.5.1

Reviewed By: antonk52

Differential Revision: D46319818

fbshipit-source-id: d218ca8f7e43abac6b00844953ddeb7f4e1010a2
This commit is contained in:
Lorenzo Blasa
2023-05-31 14:19:29 -07:00
committed by Facebook GitHub Bot
parent 94cb8935b2
commit 6430403da0
40 changed files with 1721 additions and 1787 deletions

View File

@@ -1,19 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`acknowledgeProblems 1`] = `
Object {
"acknowledgedProblems": Array [
{
"acknowledgedProblems": [
"ios.sdk",
"common.openssl",
],
"healthcheckReport": Object {
"categories": Object {
"android": Object {
"checks": Object {
"android.sdk": Object {
"healthcheckReport": {
"categories": {
"android": {
"checks": {
"android.sdk": {
"key": "android.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"isAcknowledged": true,
"status": "SUCCESS",
},
@@ -21,17 +21,17 @@ Object {
},
"key": "android",
"label": "Android",
"result": Object {
"result": {
"isAcknowledged": true,
"status": "SUCCESS",
},
},
"common": Object {
"checks": Object {
"common.openssl": Object {
"common": {
"checks": {
"common.openssl": {
"key": "common.openssl",
"label": "OpenSSL Istalled",
"result": Object {
"result": {
"isAcknowledged": true,
"status": "FAILED",
},
@@ -39,17 +39,17 @@ Object {
},
"key": "common",
"label": "Common",
"result": Object {
"result": {
"isAcknowledged": true,
"status": "FAILED",
},
},
"ios": Object {
"checks": Object {
"ios.sdk": Object {
"ios": {
"checks": {
"ios.sdk": {
"key": "ios.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"isAcknowledged": true,
"status": "FAILED",
},
@@ -57,13 +57,13 @@ Object {
},
"key": "ios",
"label": "iOS",
"result": Object {
"result": {
"isAcknowledged": true,
"status": "FAILED",
},
},
},
"result": Object {
"result": {
"isAcknowledged": true,
"status": "FAILED",
},
@@ -72,16 +72,16 @@ Object {
`;
exports[`finish 1`] = `
Object {
"acknowledgedProblems": Array [],
"healthcheckReport": Object {
"categories": Object {
"android": Object {
"checks": Object {
"android.sdk": Object {
{
"acknowledgedProblems": [],
"healthcheckReport": {
"categories": {
"android": {
"checks": {
"android.sdk": {
"key": "android.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"isAcknowledged": false,
"message": "Updated Test Message",
"status": "SUCCESS",
@@ -90,17 +90,17 @@ Object {
},
"key": "android",
"label": "Android",
"result": Object {
"result": {
"isAcknowledged": false,
"status": "SUCCESS",
},
},
"common": Object {
"checks": Object {
"common.openssl": Object {
"common": {
"checks": {
"common.openssl": {
"key": "common.openssl",
"label": "OpenSSL Istalled",
"result": Object {
"result": {
"isAcknowledged": false,
"message": "Updated Test Message",
"status": "SUCCESS",
@@ -109,17 +109,17 @@ Object {
},
"key": "common",
"label": "Common",
"result": Object {
"result": {
"isAcknowledged": false,
"status": "SUCCESS",
},
},
"ios": Object {
"checks": Object {
"ios.sdk": Object {
"ios": {
"checks": {
"ios.sdk": {
"key": "ios.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"isAcknowledged": false,
"message": "Updated Test Message",
"status": "SUCCESS",
@@ -128,13 +128,13 @@ Object {
},
"key": "ios",
"label": "iOS",
"result": Object {
"result": {
"isAcknowledged": false,
"status": "SUCCESS",
},
},
},
"result": Object {
"result": {
"status": "SUCCESS",
},
},
@@ -142,60 +142,60 @@ Object {
`;
exports[`startHealthCheck 1`] = `
Object {
"acknowledgedProblems": Array [],
"healthcheckReport": Object {
"categories": Object {
"android": Object {
"checks": Object {
"android.sdk": Object {
{
"acknowledgedProblems": [],
"healthcheckReport": {
"categories": {
"android": {
"checks": {
"android.sdk": {
"key": "android.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
},
"key": "android",
"label": "Android",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
"common": Object {
"checks": Object {
"common.openssl": Object {
"common": {
"checks": {
"common.openssl": {
"key": "common.openssl",
"label": "OpenSSL Istalled",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
},
"key": "common",
"label": "Common",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
"ios": Object {
"checks": Object {
"ios.sdk": Object {
"ios": {
"checks": {
"ios.sdk": {
"key": "ios.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
},
"key": "ios",
"label": "iOS",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
},
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
@@ -203,16 +203,16 @@ Object {
`;
exports[`statuses updated after healthchecks finished 1`] = `
Object {
"acknowledgedProblems": Array [],
"healthcheckReport": Object {
"categories": Object {
"android": Object {
"checks": Object {
"android.sdk": Object {
{
"acknowledgedProblems": [],
"healthcheckReport": {
"categories": {
"android": {
"checks": {
"android.sdk": {
"key": "android.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"isAcknowledged": false,
"message": "Updated Test Message",
"status": "FAILED",
@@ -221,17 +221,17 @@ Object {
},
"key": "android",
"label": "Android",
"result": Object {
"result": {
"isAcknowledged": false,
"status": "FAILED",
},
},
"common": Object {
"checks": Object {
"common.openssl": Object {
"common": {
"checks": {
"common.openssl": {
"key": "common.openssl",
"label": "OpenSSL Istalled",
"result": Object {
"result": {
"isAcknowledged": false,
"message": "Updated Test Message",
"status": "SUCCESS",
@@ -240,16 +240,16 @@ Object {
},
"key": "common",
"label": "Common",
"result": Object {
"result": {
"status": "SUCCESS",
},
},
"ios": Object {
"checks": Object {
"ios.sdk": Object {
"ios": {
"checks": {
"ios.sdk": {
"key": "ios.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"isAcknowledged": false,
"message": "Updated Test Message",
"status": "SUCCESS",
@@ -258,12 +258,12 @@ Object {
},
"key": "ios",
"label": "iOS",
"result": Object {
"result": {
"status": "SUCCESS",
},
},
},
"result": Object {
"result": {
"isAcknowledged": false,
"status": "FAILED",
},
@@ -272,16 +272,16 @@ Object {
`;
exports[`updateHealthcheckResult 1`] = `
Object {
"acknowledgedProblems": Array [],
"healthcheckReport": Object {
"categories": Object {
"android": Object {
"checks": Object {
"android.sdk": Object {
{
"acknowledgedProblems": [],
"healthcheckReport": {
"categories": {
"android": {
"checks": {
"android.sdk": {
"key": "android.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"isAcknowledged": false,
"message": "Updated Test Message",
"status": "SUCCESS",
@@ -290,44 +290,44 @@ Object {
},
"key": "android",
"label": "Android",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
"common": Object {
"checks": Object {
"common.openssl": Object {
"common": {
"checks": {
"common.openssl": {
"key": "common.openssl",
"label": "OpenSSL Istalled",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
},
"key": "common",
"label": "Common",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
"ios": Object {
"checks": Object {
"ios.sdk": Object {
"ios": {
"checks": {
"ios.sdk": {
"key": "ios.sdk",
"label": "SDK Installed",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
},
"key": "ios",
"label": "iOS",
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},
},
"result": Object {
"result": {
"status": "IN_PROGRESS",
},
},

View File

@@ -134,7 +134,7 @@ test('can handle plugins that throw at start', async () => {
expect(client.connected.get()).toBe(true);
expect((console.error as any).mock.calls[0]).toMatchInlineSnapshot(`
Array [
[
"Failed to start plugin 'TestPlugin': ",
[Error: Broken plugin],
]
@@ -144,7 +144,7 @@ test('can handle plugins that throw at start', async () => {
const client2 = await createClient(device2, client.query.app);
expect((console.error as any).mock.calls[1]).toMatchInlineSnapshot(`
Array [
[
"Failed to start plugin 'TestPlugin': ",
[Error: Broken plugin],
]
@@ -172,7 +172,7 @@ test('can handle device plugins that throw at start', async () => {
);
expect(mockedConsole.errorCalls[0]).toMatchInlineSnapshot(`
Array [
[
"Failed to start device plugin 'TestPlugin': ",
[Error: Broken device plugin],
]
@@ -188,7 +188,7 @@ test('can handle device plugins that throw at start', async () => {
expect(store.getState().connections.devices.length).toBe(2);
expect(device2.connected.get()).toBe(true);
expect(mockedConsole.errorCalls[1]).toMatchInlineSnapshot(`
Array [
[
"Failed to start device plugin 'TestPlugin': ",
[Error: Broken device plugin],
]

View File

@@ -142,11 +142,11 @@ test('addNotification removes duplicates', () => {
}),
);
expect(res).toMatchInlineSnapshot(`
Object {
"activeNotifications": Array [
Object {
{
"activeNotifications": [
{
"client": null,
"notification": Object {
"notification": {
"id": "otherId",
"message": "message",
"severity": "warning",
@@ -155,10 +155,10 @@ test('addNotification removes duplicates', () => {
"pluginId": "test",
},
],
"blocklistedCategories": Array [],
"blocklistedPlugins": Array [],
"blocklistedCategories": [],
"blocklistedPlugins": [],
"clearedNotifications": Set {},
"invalidatedNotifications": Array [],
"invalidatedNotifications": [],
}
`);
});
@@ -195,11 +195,11 @@ test('reduce removeNotification', () => {
}),
);
expect(res).toMatchInlineSnapshot(`
Object {
"activeNotifications": Array [
Object {
{
"activeNotifications": [
{
"client": null,
"notification": Object {
"notification": {
"id": "otherId",
"message": "message",
"severity": "warning",
@@ -207,9 +207,9 @@ test('reduce removeNotification', () => {
},
"pluginId": "test",
},
Object {
{
"client": null,
"notification": Object {
"notification": {
"id": "id",
"message": "slightly different message",
"severity": "warning",
@@ -218,10 +218,10 @@ test('reduce removeNotification', () => {
"pluginId": "test",
},
],
"blocklistedCategories": Array [],
"blocklistedPlugins": Array [],
"blocklistedCategories": [],
"blocklistedPlugins": [],
"clearedNotifications": Set {},
"invalidatedNotifications": Array [],
"invalidatedNotifications": [],
}
`);
});
@@ -248,11 +248,11 @@ test('notifications from plugins arrive in the notifications reducer', async ()
sendMessage('testMessage', {});
client.flushMessageBuffer();
expect(store.getState().notifications).toMatchInlineSnapshot(`
Object {
"activeNotifications": Array [
Object {
{
"activeNotifications": [
{
"client": "TestApp#Android#MockAndroidDevice#serial",
"notification": Object {
"notification": {
"action": "dosomething",
"id": "test",
"message": "test message",
@@ -262,10 +262,10 @@ test('notifications from plugins arrive in the notifications reducer', async ()
"pluginId": "TestPlugin",
},
],
"blocklistedCategories": Array [],
"blocklistedPlugins": Array [],
"blocklistedCategories": [],
"blocklistedPlugins": [],
"clearedNotifications": Set {},
"invalidatedNotifications": Array [],
"invalidatedNotifications": [],
}
`);
});
@@ -290,11 +290,11 @@ test('notifications from a device plugin arrive in the notifications reducer', a
const {store} = await createMockFlipperWithPlugin(TestPlugin);
trigger();
expect(store.getState().notifications).toMatchInlineSnapshot(`
Object {
"activeNotifications": Array [
Object {
{
"activeNotifications": [
{
"client": "serial",
"notification": Object {
"notification": {
"action": "dosomething",
"id": "test",
"message": "test message",
@@ -304,10 +304,10 @@ test('notifications from a device plugin arrive in the notifications reducer', a
"pluginId": "TestPlugin",
},
],
"blocklistedCategories": Array [],
"blocklistedPlugins": Array [],
"blocklistedCategories": [],
"blocklistedPlugins": [],
"clearedNotifications": Set {},
"invalidatedNotifications": Array [],
"invalidatedNotifications": [],
}
`);
});
@@ -334,25 +334,25 @@ test('errors end up as notifications if crash reporter is active', async () => {
sendError('gone wrong');
client.flushMessageBuffer();
expect(store.getState().notifications).toMatchInlineSnapshot(`
Object {
"activeNotifications": Array [
Object {
{
"activeNotifications": [
{
"client": "serial",
"notification": Object {
"notification": {
"action": "0",
"category": "\\"gone wrong\\"",
"category": ""gone wrong"",
"id": "0",
"message": "Callstack: No callstack available",
"severity": "error",
"title": "CRASH: Plugin ErrorReason: \\"gone wrong\\"",
"title": "CRASH: Plugin ErrorReason: "gone wrong"",
},
"pluginId": "CrashReporter",
},
],
"blocklistedCategories": Array [],
"blocklistedPlugins": Array [],
"blocklistedCategories": [],
"blocklistedPlugins": [],
"clearedNotifications": Set {},
"invalidatedNotifications": Array [],
"invalidatedNotifications": [],
}
`);
});
@@ -386,12 +386,12 @@ test('errors end NOT up as notifications if crash reporter is active but suppres
sendError('gone wrong');
client.flushMessageBuffer();
expect(store.getState().notifications).toMatchInlineSnapshot(`
Object {
"activeNotifications": Array [],
"blocklistedCategories": Array [],
"blocklistedPlugins": Array [],
{
"activeNotifications": [],
"blocklistedCategories": [],
"blocklistedPlugins": [],
"clearedNotifications": Set {},
"invalidatedNotifications": Array [],
"invalidatedNotifications": [],
}
`);
});

View File

@@ -230,10 +230,10 @@ test('it can send messages from sandy clients', async () => {
client.initPlugin(TestPlugin.id);
await pluginInstance.send('test', {test: 3});
expect(testMethodCalledWith).toMatchInlineSnapshot(`
Object {
{
"api": "TestPlugin",
"method": "test",
"params": Object {
"params": {
"test": 3,
},
}