Skip to content

Commit 581a5b9

Browse files
committed
fix(playground): skip native LogBox probe on web
Avoid evaluating the native PlaygroundCrash TurboModule during web harness runs while keeping the native LogBox assertion active on native platforms.
1 parent 84c9336 commit 581a5b9

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

apps/playground/src/__tests__/logbox-disabled.harness.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
type TurboModule,
66
TurboModuleRegistry,
77
} from 'react-native';
8-
import PlaygroundCrash from '../native/PlaygroundCrash';
98

109
const HANDLED_ERROR_MARKER = 'HARNESS_LOGBOX_HANDLED_NATIVE_ERROR';
1110
const CONSOLE_PROBE_MARKER = 'HARNESS_LOGBOX_CONSOLE_PROBE';
@@ -40,7 +39,7 @@ describe('LogBox disabled for harness', () => {
4039

4140
it('noops the native LogBox TurboModule when linked', () => {
4241
const nativeLogBox =
43-
TurboModuleRegistry.get<NativeLogBoxModule>('LogBox');
42+
TurboModuleRegistry?.get<NativeLogBoxModule>('LogBox');
4443

4544
if (nativeLogBox == null) {
4645
return;
@@ -50,7 +49,15 @@ describe('LogBox disabled for harness', () => {
5049
expect(() => nativeLogBox.hide()).not.toThrow();
5150
});
5251

53-
it('surfaces handled native errors on the sync Turbo Module path', () => {
52+
it('surfaces handled native errors on the sync Turbo Module path', async (context) => {
53+
context.skip(
54+
Platform.OS === 'web',
55+
'PlaygroundCrash is a native-only TurboModule',
56+
);
57+
58+
const { default: PlaygroundCrash } = await import(
59+
'../native/PlaygroundCrash'
60+
);
5461
const marker = `${HANDLED_ERROR_MARKER} platform=${Platform.OS}`;
5562

5663
expect(() => PlaygroundCrash.crashHandled(marker)).toThrow(

0 commit comments

Comments
 (0)