From 40567c21e949ef686367bb39fdb48e34236cbd82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Thu, 6 Oct 2022 06:54:05 -0700 Subject: [PATCH] Fix TypeScript tests Summary: I fixed the TypeScript definitions for Systrace in https://github.com/facebook/react-native/commit/a0f56adb07dd21ee69ad1942e9d485586f1c3ec0, but I forgot to update the TypeScript tests that were outdated. This diff fixes those tests and CI in OSS. Changelog: [internal] Reviewed By: cipolleschi Differential Revision: D40141920 fbshipit-source-id: f73501450af0be6b0b6f836b9a774abb1fa4f620 --- types/__typetests__/index.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/types/__typetests__/index.tsx b/types/__typetests__/index.tsx index b344d83ced9..acf7713e18a 100644 --- a/types/__typetests__/index.tsx +++ b/types/__typetests__/index.tsx @@ -614,8 +614,21 @@ const AppStateExample = () => { ); }; -const profiledJSONParse = Systrace.measure('JSON', 'parse', JSON.parse); -profiledJSONParse('[]'); +if (Systrace.isEnabled()) { + const cookie = Systrace.beginAsyncEvent('async-event'); + Systrace.endAsyncEvent('async-event', cookie); + + const cookie2 = Systrace.beginAsyncEvent('async-event-2', {foo: '123'}); + Systrace.endAsyncEvent('async-event-2', cookie2, {bar: '456'}); + + Systrace.beginEvent('sync-event'); + Systrace.endEvent(); + + Systrace.beginEvent('sync-event-2', {key: 'value'}); + Systrace.endEvent({key: 'other-value'}); + + Systrace.counterEvent('counter', 123); +} InteractionManager.runAfterInteractions(() => { // ...