Skip to content

Commit b08ee50

Browse files
committed
chore: remove debug shallow
1 parent f48a964 commit b08ee50

File tree

8 files changed

+6
-158
lines changed

8 files changed

+6
-158
lines changed

src/__tests__/__snapshots__/render-debug.test.tsx.snap

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -367,106 +367,6 @@ exports[`debug: another custom message 1`] = `
367367
</View>"
368368
`;
369369

370-
exports[`debug: shallow 1`] = `
371-
"<View>
372-
<Text>
373-
Is the banana fresh?
374-
</Text>
375-
<Text
376-
testID="bananaFresh"
377-
>
378-
not fresh
379-
</Text>
380-
<TextInput
381-
placeholder="Add custom freshness"
382-
testID="bananaCustomFreshness"
383-
value="Custom Freshie"
384-
/>
385-
<TextInput
386-
defaultValue="What did you inspect?"
387-
placeholder="Who inspected freshness?"
388-
testID="bananaChef"
389-
value="I inspected freshie"
390-
/>
391-
<TextInput
392-
defaultValue="What banana?"
393-
/>
394-
<TextInput
395-
defaultValue="hello"
396-
value=""
397-
/>
398-
<MyButton
399-
onPress={[Function anonymous]}
400-
>
401-
Change freshness!
402-
</MyButton>
403-
<Text
404-
testID="duplicateText"
405-
>
406-
First Text
407-
</Text>
408-
<Text
409-
testID="duplicateText"
410-
>
411-
Second Text
412-
</Text>
413-
<Text>
414-
0
415-
</Text>
416-
</View>"
417-
`;
418-
419-
exports[`debug: shallow with message 1`] = `
420-
"my other custom message
421-
422-
<View>
423-
<Text>
424-
Is the banana fresh?
425-
</Text>
426-
<Text
427-
testID="bananaFresh"
428-
>
429-
not fresh
430-
</Text>
431-
<TextInput
432-
placeholder="Add custom freshness"
433-
testID="bananaCustomFreshness"
434-
value="Custom Freshie"
435-
/>
436-
<TextInput
437-
defaultValue="What did you inspect?"
438-
placeholder="Who inspected freshness?"
439-
testID="bananaChef"
440-
value="I inspected freshie"
441-
/>
442-
<TextInput
443-
defaultValue="What banana?"
444-
/>
445-
<TextInput
446-
defaultValue="hello"
447-
value=""
448-
/>
449-
<MyButton
450-
onPress={[Function anonymous]}
451-
>
452-
Change freshness!
453-
</MyButton>
454-
<Text
455-
testID="duplicateText"
456-
>
457-
First Text
458-
</Text>
459-
<Text
460-
testID="duplicateText"
461-
>
462-
Second Text
463-
</Text>
464-
<Text>
465-
0
466-
</Text>
467-
</View>"
468-
`;
469-
470370
exports[`debug: with message 1`] = `
471371
"my custom message
472372

src/__tests__/render-debug.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,12 @@ test('debug', () => {
9797

9898
screen.debug();
9999
screen.debug('my custom message');
100-
screen.debug.shallow();
101-
screen.debug.shallow('my other custom message');
102100
screen.debug({ message: 'another custom message' });
103101

104102
const mockCalls = jest.mocked(console.log).mock.calls;
105103
expect(stripAnsi(mockCalls[0][0])).toMatchSnapshot();
106104
expect(stripAnsi(mockCalls[1][0] + mockCalls[1][1])).toMatchSnapshot('with message');
107-
expect(stripAnsi(mockCalls[2][0])).toMatchSnapshot('shallow');
108-
expect(stripAnsi(mockCalls[3][0] + mockCalls[3][1])).toMatchSnapshot('shallow with message');
109-
expect(stripAnsi(mockCalls[4][0] + mockCalls[4][1])).toMatchSnapshot('another custom message');
105+
expect(stripAnsi(mockCalls[2][0] + mockCalls[2][1])).toMatchSnapshot('another custom message');
110106

111107
const mockWarnCalls = jest.mocked(console.warn).mock.calls;
112108
expect(mockWarnCalls[0]).toEqual([

src/__tests__/screen.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,5 @@ test('screen throws without render', () => {
5555
expect(() => screen.root).toThrow('`render` method has not been called');
5656
expect(() => screen.UNSAFE_root).toThrow('`render` method has not been called');
5757
expect(() => screen.debug()).toThrow('`render` method has not been called');
58-
expect(() => screen.debug.shallow()).toThrow('`render` method has not been called');
5958
expect(() => screen.getByText('Mt. Everest')).toThrow('`render` method has not been called');
6059
});

src/helpers/debug-shallow.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/render.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { addToCleanupQueue } from './cleanup';
66
import { getConfig } from './config';
77
import { getHostChildren } from './helpers/component-tree';
88
import debugDeep, { DebugOptions } from './helpers/debug-deep';
9-
import debugShallow from './helpers/debug-shallow';
109
import { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';
1110
import { validateStringsRenderedWithinText } from './helpers/string-validation';
1211
import { renderWithAct } from './render-act';
@@ -142,10 +141,7 @@ function updateWithAct(
142141
};
143142
}
144143

145-
export interface DebugFunction {
146-
(options?: DebugOptions | string): void;
147-
shallow: (message?: string) => void;
148-
}
144+
export type DebugFunction = (options?: DebugOptions | string) => void;
149145

150146
function debug(instance: ReactTestInstance, renderer: ReactTestRenderer): DebugFunction {
151147
function debugImpl(options?: DebugOptions | string) {
@@ -167,6 +163,5 @@ function debug(instance: ReactTestInstance, renderer: ReactTestRenderer): DebugF
167163
return debugDeep(json, debugOptions);
168164
}
169165
}
170-
debugImpl.shallow = (message?: string) => debugShallow(instance, message);
171166
return debugImpl;
172167
}

src/screen.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const notImplemented = () => {
1010
const notImplementedDebug = () => {
1111
throw new Error(SCREEN_ERROR);
1212
};
13-
notImplementedDebug.shallow = notImplemented;
1413

1514
interface Screen extends RenderResult {
1615
isDetached?: boolean;

src/shallow.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

typings/index.flow.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ declare type A11yRole =
5555

5656
declare type A11yState = {|
5757
disabled?: boolean,
58-
selected?: boolean,
59-
checked?: boolean | 'mixed',
60-
busy?: boolean,
61-
expanded?: boolean,
58+
selected ?: boolean,
59+
checked ?: boolean | 'mixed',
60+
busy ?: boolean,
61+
expanded ?: boolean,
6262
|};
6363

6464
declare type A11yValue = {
@@ -308,7 +308,6 @@ type DebugOptions = {
308308

309309
type Debug = {
310310
(options?: DebugOptions | string): void,
311-
shallow: (message?: string) => void,
312311
};
313312

314313
type Queries = ByTextQueries &

0 commit comments

Comments
 (0)