Skip to content

Commit 38058e9

Browse files
committed
.
1 parent 34b1915 commit 38058e9

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

src/__tests__/render-debug.test.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,8 @@ const INPUT_CHEF = 'I inspected freshie';
1111
const DEFAULT_INPUT_CHEF = 'What did you inspect?';
1212
const DEFAULT_INPUT_CUSTOMER = 'What banana?';
1313

14-
const ignoreWarnings = ['Using debug("message") is deprecated'];
15-
1614
beforeEach(() => {
1715
jest.spyOn(logger, 'info').mockImplementation(() => {});
18-
jest.spyOn(logger, 'warn').mockImplementation((message) => {
19-
if (!ignoreWarnings.some((warning) => `${message}`.includes(warning))) {
20-
logger.warn(message);
21-
}
22-
});
2316
});
2417

2518
afterEach(() => {

src/helpers/__tests__/format-element.test.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ test('formatElement', () => {
1212
</View>,
1313
);
1414

15+
expect(formatElement(null)).toMatchInlineSnapshot(`"(null)"`);
16+
expect(formatElement('Hello World')).toMatchInlineSnapshot(`"Hello World"`);
17+
1518
expect(formatElement(screen.getByTestId('view'), { mapProps: null })).toMatchInlineSnapshot(`
1619
"<View
1720
testID="view"

src/render.tsx

+3-14
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,12 @@ function buildRenderResult(
7979
return result;
8080
}
8181

82-
export type DebugFunction = (options?: DebugOptions | string) => void;
82+
export type DebugFunction = (options?: DebugOptions) => void;
8383

8484
function makeDebug(renderer: Root): DebugFunction {
85-
function debugImpl(options?: DebugOptions | string) {
85+
function debugImpl(options?: DebugOptions) {
8686
const { defaultDebugOptions } = getConfig();
87-
const debugOptions =
88-
typeof options === 'string'
89-
? { ...defaultDebugOptions, message: options }
90-
: { ...defaultDebugOptions, ...options };
91-
92-
if (typeof options === 'string') {
93-
// eslint-disable-next-line no-console
94-
console.warn(
95-
'Using debug("message") is deprecated and will be removed in future release, please use debug({ message: "message" }) instead.',
96-
);
97-
}
98-
87+
const debugOptions = { ...defaultDebugOptions, ...options };
9988
const json = renderer.root?.toJSON();
10089
if (json) {
10190
return debug(json, debugOptions);

0 commit comments

Comments
 (0)