From 35698311de3c068be9a542e1a2c545d718ec4782 Mon Sep 17 00:00:00 2001 From: Ming Ye Date: Fri, 10 Feb 2023 07:08:37 +0800 Subject: [PATCH] Update jest escapeString config (#26140) ## Summary In jest v29, snapshotFormat default to escapeString: false(https://github.com/facebook/jest/pull/13036) ## How did you test this change? ci green --- .../src/__tests__/inspectedElement-test.js | 2 +- .../src/__tests__/profilingCharts-test.js | 18 +- .../src/__tests__/storeOwners-test.js | 22 +-- .../storeStressTestConcurrent-test.js | 120 ++++++------ .../ReactDOMFizzServerBrowser-test.js | 2 +- .../__tests__/ReactDOMFizzServerNode-test.js | 2 +- .../ReactDOMFizzStaticBrowser-test.js | 2 +- .../__tests__/ReactDOMFizzStaticNode-test.js | 2 +- .../__tests__/ReactDOMHydrationDiff-test.js | 32 ++-- .../ReactFabric-test.internal.js.snap | 172 +++++++++--------- .../ReactNativeEvents-test.internal.js.snap | 4 +- .../ReactNativeMount-test.internal.js.snap | 80 ++++---- .../ReactDOMServerFB-test.internal.js | 2 +- ...actFlightNativeRelay-test.internal.js.snap | 6 +- .../react/src/__tests__/ReactFetch-test.js | 2 +- .../transform-error-messages.js.snap | 16 +- scripts/jest/config.base.js | 1 - 17 files changed, 242 insertions(+), 243 deletions(-) diff --git a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js index 2606213faa4a7..39c515d985ec1 100644 --- a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js @@ -2500,7 +2500,7 @@ describe('InspectedElement', () => { Object { "errors": Array [ Array [ - "Warning: Each child in a list should have a unique \\"key\\" prop. See https://reactjs.org/link/warning-keys for more information. + "Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information. at Example", 1, ], diff --git a/packages/react-devtools-shared/src/__tests__/profilingCharts-test.js b/packages/react-devtools-shared/src/__tests__/profilingCharts-test.js index 420d345f68660..5a73cea587879 100644 --- a/packages/react-devtools-shared/src/__tests__/profilingCharts-test.js +++ b/packages/react-devtools-shared/src/__tests__/profilingCharts-test.js @@ -125,7 +125,7 @@ describe('profiling charts', () => { "actualDuration": 0, "didRender": true, "id": 5, - "label": "Memo(Child) key=\\"third\\" (<0.1ms of <0.1ms)", + "label": "Memo(Child) key="third" (<0.1ms of <0.1ms)", "name": "Memo(Child)", "offset": 15, "selfDuration": 0, @@ -135,7 +135,7 @@ describe('profiling charts', () => { "actualDuration": 2, "didRender": true, "id": 4, - "label": "Memo(Child) key=\\"second\\" (2ms of 2ms)", + "label": "Memo(Child) key="second" (2ms of 2ms)", "name": "Memo(Child)", "offset": 13, "selfDuration": 2, @@ -145,7 +145,7 @@ describe('profiling charts', () => { "actualDuration": 3, "didRender": true, "id": 3, - "label": "Memo(Child) key=\\"first\\" (3ms of 3ms)", + "label": "Memo(Child) key="first" (3ms of 3ms)", "name": "Memo(Child)", "offset": 10, "selfDuration": 3, @@ -176,7 +176,7 @@ describe('profiling charts', () => { "actualDuration": 0, "didRender": false, "id": 5, - "label": "Memo(Child) key=\\"third\\"", + "label": "Memo(Child) key="third"", "name": "Memo(Child)", "offset": 15, "selfDuration": 0, @@ -186,7 +186,7 @@ describe('profiling charts', () => { "actualDuration": 0, "didRender": false, "id": 4, - "label": "Memo(Child) key=\\"second\\"", + "label": "Memo(Child) key="second"", "name": "Memo(Child)", "offset": 13, "selfDuration": 0, @@ -196,7 +196,7 @@ describe('profiling charts', () => { "actualDuration": 0, "didRender": false, "id": 3, - "label": "Memo(Child) key=\\"first\\"", + "label": "Memo(Child) key="first"", "name": "Memo(Child)", "offset": 10, "selfDuration": 0, @@ -267,19 +267,19 @@ describe('profiling charts', () => { }, Object { "id": 3, - "label": "Memo(Child) (Memo) key=\\"first\\" (3ms)", + "label": "Memo(Child) (Memo) key="first" (3ms)", "name": "Memo(Child)", "value": 3, }, Object { "id": 4, - "label": "Memo(Child) (Memo) key=\\"second\\" (2ms)", + "label": "Memo(Child) (Memo) key="second" (2ms)", "name": "Memo(Child)", "value": 2, }, Object { "id": 5, - "label": "Memo(Child) (Memo) key=\\"third\\" (<0.1ms)", + "label": "Memo(Child) (Memo) key="third" (<0.1ms)", "name": "Memo(Child)", "value": 0, }, diff --git a/packages/react-devtools-shared/src/__tests__/storeOwners-test.js b/packages/react-devtools-shared/src/__tests__/storeOwners-test.js index 5694da5840238..df388f69a6c06 100644 --- a/packages/react-devtools-shared/src/__tests__/storeOwners-test.js +++ b/packages/react-devtools-shared/src/__tests__/storeOwners-test.js @@ -94,16 +94,16 @@ describe('Store owners list', () => { const rootID = store.getElementIDAtIndex(0); expect(getFormattedOwnersList(rootID)).toMatchInlineSnapshot(` " ▾ - ▾ + ▾ - " + " `); const intermediateID = store.getElementIDAtIndex(1); expect(getFormattedOwnersList(intermediateID)).toMatchInlineSnapshot(` - " ▾ - - ▾ " + " ▾ + + ▾ " `); }); @@ -217,9 +217,9 @@ describe('Store owners list', () => { `); expect(getFormattedOwnersList(rootID)).toMatchInlineSnapshot(` " ▾ - - - " + + + " `); act(() => legacyRender(, container)); @@ -232,9 +232,9 @@ describe('Store owners list', () => { `); expect(getFormattedOwnersList(rootID)).toMatchInlineSnapshot(` " ▾ - - - " + + + " `); }); }); diff --git a/packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js b/packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js index 439206673487f..d504481841eae 100644 --- a/packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js +++ b/packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js @@ -262,58 +262,58 @@ describe('StoreStressConcurrent', () => { Array [ "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - ", + ", "[root] ▾ - - ", + + ", "[root] ▾ - - ", + + ", "[root] ▾ - - ", + + ", "[root] ▾ - - ", + + ", "[root] ▾ - - ", + + ", "[root] ▾ - - ", + + ", ] `); @@ -435,63 +435,63 @@ describe('StoreStressConcurrent', () => { ▾ - + ", "[root] ▾ - + ", "[root] ▾ - - - + + + ", "[root] ▾ - - - + + + ", "[root] ▾ - - + + ", "[root] ▾ - - + + ", "[root] ▾ - - + + ", "[root] ▾ - - + + ", "[root] ▾ - + ", "[root] ▾ @@ -502,13 +502,13 @@ describe('StoreStressConcurrent', () => { ▾ - + ", "[root] ▾ - + ", ] `); @@ -956,7 +956,7 @@ describe('StoreStressConcurrent', () => { - + ", "[root] @@ -964,7 +964,7 @@ describe('StoreStressConcurrent', () => { - + ", "[root] @@ -972,9 +972,9 @@ describe('StoreStressConcurrent', () => { - - - + + + ", "[root] @@ -982,9 +982,9 @@ describe('StoreStressConcurrent', () => { - - - + + + ", "[root] @@ -992,8 +992,8 @@ describe('StoreStressConcurrent', () => { - - + + ", "[root] @@ -1001,8 +1001,8 @@ describe('StoreStressConcurrent', () => { - - + + ", "[root] @@ -1010,8 +1010,8 @@ describe('StoreStressConcurrent', () => { - - + + ", "[root] @@ -1019,8 +1019,8 @@ describe('StoreStressConcurrent', () => { - - + + ", "[root] @@ -1028,7 +1028,7 @@ describe('StoreStressConcurrent', () => { - + ", "[root] @@ -1043,7 +1043,7 @@ describe('StoreStressConcurrent', () => { - + ", "[root] @@ -1051,7 +1051,7 @@ describe('StoreStressConcurrent', () => { - + ", ] diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js index 91fcf100083c8..20f902de42d1a 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js @@ -78,7 +78,7 @@ describe('ReactDOMFizzServerBrowser', () => { ); const result = await readResult(stream); expect(result).toMatchInlineSnapshot( - `"
hello world
"`, + `"
hello world
"`, ); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js index a5b2b5ac417a8..594da3e2ec3f3 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js @@ -91,7 +91,7 @@ describe('ReactDOMFizzServerNode', () => { pipe(writable); jest.runAllTimers(); expect(output.result).toMatchInlineSnapshot( - `"
hello world
"`, + `"
hello world
"`, ); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js index d0195b16d0bc2..13b96d893d381 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js @@ -78,7 +78,7 @@ describe('ReactDOMFizzStaticBrowser', () => { }); const prelude = await readContent(result.prelude); expect(prelude).toMatchInlineSnapshot( - `"
hello world
"`, + `"
hello world
"`, ); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js index 1ec296fd94e01..cbf822eb6286b 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js @@ -80,7 +80,7 @@ describe('ReactDOMFizzStaticNode', () => { ); const prelude = await readContent(result.prelude); expect(prelude).toMatchInlineSnapshot( - `"
hello world
"`, + `"
hello world
"`, ); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js b/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js index bbfcab709ef50..8a37ddaa007c0 100644 --- a/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js @@ -92,7 +92,7 @@ describe('ReactDOMServerHydration', () => { if (gate(flags => flags.enableClientRenderFallbackOnTextMismatch)) { expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Text content did not match. Server: \\"server\\" Client: \\"client\\" + "Warning: Text content did not match. Server: "server" Client: "client" in main (at **) in div (at **) in Mismatch (at **)", @@ -104,7 +104,7 @@ describe('ReactDOMServerHydration', () => { } else { expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Text content did not match. Server: \\"server\\" Client: \\"client\\" + "Warning: Text content did not match. Server: "server" Client: "client" in main (at **) in div (at **) in Mismatch (at **)", @@ -131,7 +131,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Prop \`dangerouslySetInnerHTML\` did not match. Server: \\"server\\" Client: \\"client\\" + "Warning: Prop \`dangerouslySetInnerHTML\` did not match. Server: "server" Client: "client" in main (at **) in div (at **) in Mismatch (at **)", @@ -155,7 +155,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Prop \`className\` did not match. Server: \\"child server\\" Client: \\"child client\\" + "Warning: Prop \`className\` did not match. Server: "child server" Client: "child client" in main (at **) in div (at **) in Mismatch (at **)", @@ -178,7 +178,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Prop \`tabIndex\` did not match. Server: \\"null\\" Client: \\"1\\" + "Warning: Prop \`tabIndex\` did not match. Server: "null" Client: "1" in main (at **) in div (at **) in Mismatch (at **)", @@ -224,7 +224,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Prop \`tabIndex\` did not match. Server: \\"null\\" Client: \\"1\\" + "Warning: Prop \`tabIndex\` did not match. Server: "null" Client: "1" in main (at **) in div (at **) in Mismatch (at **)", @@ -248,7 +248,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Prop \`style\` did not match. Server: \\"opacity:0\\" Client: \\"opacity:1\\" + "Warning: Prop \`style\` did not match. Server: "opacity:0" Client: "opacity:1" in main (at **) in div (at **) in Mismatch (at **)", @@ -363,7 +363,7 @@ describe('ReactDOMServerHydration', () => { if (gate(flags => flags.enableClientRenderFallbackOnTextMismatch)) { expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Text content did not match. Server: \\"\\" Client: \\"only\\" + "Warning: Text content did not match. Server: "" Client: "only" in div (at **) in Mismatch (at **)", "Warning: An error occurred during hydration. The server HTML was replaced with client content in
.", @@ -374,7 +374,7 @@ describe('ReactDOMServerHydration', () => { } else { expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Text content did not match. Server: \\"\\" Client: \\"only\\" + "Warning: Text content did not match. Server: "" Client: "only" in div (at **) in Mismatch (at **)", ] @@ -395,7 +395,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Expected server HTML to contain a matching text node for \\"second\\" in
. + "Warning: Expected server HTML to contain a matching text node for "second" in
. in div (at **) in Mismatch (at **)", "Warning: An error occurred during hydration. The server HTML was replaced with client content in
.", @@ -418,7 +418,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Expected server HTML to contain a matching text node for \\"first\\" in
. + "Warning: Expected server HTML to contain a matching text node for "first" in
. in div (at **) in Mismatch (at **)", "Warning: An error occurred during hydration. The server HTML was replaced with client content in
.", @@ -441,7 +441,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Expected server HTML to contain a matching text node for \\"third\\" in
. + "Warning: Expected server HTML to contain a matching text node for "third" in
. in div (at **) in Mismatch (at **)", "Warning: An error occurred during hydration. The server HTML was replaced with client content in
.", @@ -557,7 +557,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Did not expect server HTML to contain the text node \\"only\\" in
. + "Warning: Did not expect server HTML to contain the text node "only" in
. in div (at **) in Mismatch (at **)", "Warning: An error occurred during hydration. The server HTML was replaced with client content in
.", @@ -629,7 +629,7 @@ describe('ReactDOMServerHydration', () => { } expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Warning: Did not expect server HTML to contain the text node \\"third\\" in
. + "Warning: Did not expect server HTML to contain the text node "third" in
. in div (at **) in Mismatch (at **)", "Warning: An error occurred during hydration. The server HTML was replaced with client content in
.", @@ -823,7 +823,7 @@ describe('ReactDOMServerHydration', () => { expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Caught [The server did not finish this Suspense boundary: The server used \\"renderToString\\" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to \\"renderToPipeableStream\\" which supports Suspense on the server]", + "Caught [The server did not finish this Suspense boundary: The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server]", ] `); }); @@ -849,7 +849,7 @@ describe('ReactDOMServerHydration', () => { expect(testMismatch(Mismatch)).toMatchInlineSnapshot(` Array [ - "Caught [The server did not finish this Suspense boundary: The server used \\"renderToString\\" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to \\"renderToPipeableStream\\" which supports Suspense on the server]", + "Caught [The server did not finish this Suspense boundary: The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server]", ] `); }); diff --git a/packages/react-native-renderer/src/__tests__/__snapshots__/ReactFabric-test.internal.js.snap b/packages/react-native-renderer/src/__tests__/__snapshots__/ReactFabric-test.internal.js.snap index 49ecc42c5065c..a97d03c0fd8df 100644 --- a/packages/react-native-renderer/src/__tests__/__snapshots__/ReactFabric-test.internal.js.snap +++ b/packages/react-native-renderer/src/__tests__/__snapshots__/ReactFabric-test.internal.js.snap @@ -4,119 +4,119 @@ exports[`ReactFabric recreates host parents even if only children changed 1`] = "11 RCTView null RCTView null - RCTView {\\"title\\":\\"a\\"} - RCTView {\\"title\\":\\"b\\"} - RCTView {\\"title\\":\\"c\\"} - RCTView {\\"title\\":\\"d\\"} - RCTView {\\"title\\":\\"e\\"} - RCTView {\\"title\\":\\"f\\"} - RCTView {\\"title\\":\\"g\\"} - RCTView {\\"title\\":\\"h\\"} - RCTView {\\"title\\":\\"i\\"} - RCTView {\\"title\\":\\"j\\"} - RCTView {\\"title\\":\\"k\\"} - RCTView {\\"title\\":\\"l\\"} - RCTView {\\"title\\":\\"m\\"} - RCTView {\\"title\\":\\"n\\"} - RCTView {\\"title\\":\\"o\\"} - RCTView {\\"title\\":\\"p\\"} - RCTView {\\"title\\":\\"q\\"} - RCTView {\\"title\\":\\"r\\"} - RCTView {\\"title\\":\\"s\\"} - RCTView {\\"title\\":\\"t\\"}" + RCTView {"title":"a"} + RCTView {"title":"b"} + RCTView {"title":"c"} + RCTView {"title":"d"} + RCTView {"title":"e"} + RCTView {"title":"f"} + RCTView {"title":"g"} + RCTView {"title":"h"} + RCTView {"title":"i"} + RCTView {"title":"j"} + RCTView {"title":"k"} + RCTView {"title":"l"} + RCTView {"title":"m"} + RCTView {"title":"n"} + RCTView {"title":"o"} + RCTView {"title":"p"} + RCTView {"title":"q"} + RCTView {"title":"r"} + RCTView {"title":"s"} + RCTView {"title":"t"}" `; exports[`ReactFabric recreates host parents even if only children changed 2`] = ` "11 RCTView null RCTView null - RCTView {\\"title\\":\\"m\\"} - RCTView {\\"title\\":\\"x\\"} - RCTView {\\"title\\":\\"h\\"} - RCTView {\\"title\\":\\"p\\"} - RCTView {\\"title\\":\\"g\\"} - RCTView {\\"title\\":\\"w\\"} - RCTView {\\"title\\":\\"f\\"} - RCTView {\\"title\\":\\"r\\"} - RCTView {\\"title\\":\\"a\\"} - RCTView {\\"title\\":\\"l\\"} - RCTView {\\"title\\":\\"k\\"} - RCTView {\\"title\\":\\"e\\"} - RCTView {\\"title\\":\\"o\\"} - RCTView {\\"title\\":\\"i\\"} - RCTView {\\"title\\":\\"v\\"} - RCTView {\\"title\\":\\"c\\"} - RCTView {\\"title\\":\\"s\\"} - RCTView {\\"title\\":\\"t\\"} - RCTView {\\"title\\":\\"z\\"} - RCTView {\\"title\\":\\"y\\"}" + RCTView {"title":"m"} + RCTView {"title":"x"} + RCTView {"title":"h"} + RCTView {"title":"p"} + RCTView {"title":"g"} + RCTView {"title":"w"} + RCTView {"title":"f"} + RCTView {"title":"r"} + RCTView {"title":"a"} + RCTView {"title":"l"} + RCTView {"title":"k"} + RCTView {"title":"e"} + RCTView {"title":"o"} + RCTView {"title":"i"} + RCTView {"title":"v"} + RCTView {"title":"c"} + RCTView {"title":"s"} + RCTView {"title":"t"} + RCTView {"title":"z"} + RCTView {"title":"y"}" `; exports[`ReactFabric renders and reorders children 1`] = ` "11 RCTView null - RCTView {\\"title\\":\\"a\\"} - RCTView {\\"title\\":\\"b\\"} - RCTView {\\"title\\":\\"c\\"} - RCTView {\\"title\\":\\"d\\"} - RCTView {\\"title\\":\\"e\\"} - RCTView {\\"title\\":\\"f\\"} - RCTView {\\"title\\":\\"g\\"} - RCTView {\\"title\\":\\"h\\"} - RCTView {\\"title\\":\\"i\\"} - RCTView {\\"title\\":\\"j\\"} - RCTView {\\"title\\":\\"k\\"} - RCTView {\\"title\\":\\"l\\"} - RCTView {\\"title\\":\\"m\\"} - RCTView {\\"title\\":\\"n\\"} - RCTView {\\"title\\":\\"o\\"} - RCTView {\\"title\\":\\"p\\"} - RCTView {\\"title\\":\\"q\\"} - RCTView {\\"title\\":\\"r\\"} - RCTView {\\"title\\":\\"s\\"} - RCTView {\\"title\\":\\"t\\"}" + RCTView {"title":"a"} + RCTView {"title":"b"} + RCTView {"title":"c"} + RCTView {"title":"d"} + RCTView {"title":"e"} + RCTView {"title":"f"} + RCTView {"title":"g"} + RCTView {"title":"h"} + RCTView {"title":"i"} + RCTView {"title":"j"} + RCTView {"title":"k"} + RCTView {"title":"l"} + RCTView {"title":"m"} + RCTView {"title":"n"} + RCTView {"title":"o"} + RCTView {"title":"p"} + RCTView {"title":"q"} + RCTView {"title":"r"} + RCTView {"title":"s"} + RCTView {"title":"t"}" `; exports[`ReactFabric renders and reorders children 2`] = ` "11 RCTView null - RCTView {\\"title\\":\\"m\\"} - RCTView {\\"title\\":\\"x\\"} - RCTView {\\"title\\":\\"h\\"} - RCTView {\\"title\\":\\"p\\"} - RCTView {\\"title\\":\\"g\\"} - RCTView {\\"title\\":\\"w\\"} - RCTView {\\"title\\":\\"f\\"} - RCTView {\\"title\\":\\"r\\"} - RCTView {\\"title\\":\\"a\\"} - RCTView {\\"title\\":\\"l\\"} - RCTView {\\"title\\":\\"k\\"} - RCTView {\\"title\\":\\"e\\"} - RCTView {\\"title\\":\\"o\\"} - RCTView {\\"title\\":\\"i\\"} - RCTView {\\"title\\":\\"v\\"} - RCTView {\\"title\\":\\"c\\"} - RCTView {\\"title\\":\\"s\\"} - RCTView {\\"title\\":\\"t\\"} - RCTView {\\"title\\":\\"z\\"} - RCTView {\\"title\\":\\"y\\"}" + RCTView {"title":"m"} + RCTView {"title":"x"} + RCTView {"title":"h"} + RCTView {"title":"p"} + RCTView {"title":"g"} + RCTView {"title":"w"} + RCTView {"title":"f"} + RCTView {"title":"r"} + RCTView {"title":"a"} + RCTView {"title":"l"} + RCTView {"title":"k"} + RCTView {"title":"e"} + RCTView {"title":"o"} + RCTView {"title":"i"} + RCTView {"title":"v"} + RCTView {"title":"c"} + RCTView {"title":"s"} + RCTView {"title":"t"} + RCTView {"title":"z"} + RCTView {"title":"y"}" `; exports[`ReactFabric should call complete after inserting children 1`] = ` Array [ - "RCTView {\\"foo\\":\\"a\\"} - RCTView {\\"foo\\":\\"b\\"}", + "RCTView {"foo":"a"} + RCTView {"foo":"b"}", ] `; exports[`ReactFabric should only pass props diffs to FabricUIManager.cloneNode 1`] = ` "11 - RCTText {\\"foo\\":\\"a\\",\\"bar\\":\\"b\\"} - RCTRawText {\\"text\\":\\"1\\"}" + RCTText {"foo":"a","bar":"b"} + RCTRawText {"text":"1"}" `; exports[`ReactFabric should only pass props diffs to FabricUIManager.cloneNode 2`] = ` "11 - RCTText {\\"foo\\":\\"b\\",\\"bar\\":\\"b\\"} - RCTRawText {\\"text\\":\\"2\\"}" + RCTText {"foo":"b","bar":"b"} + RCTRawText {"text":"2"}" `; diff --git a/packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeEvents-test.internal.js.snap b/packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeEvents-test.internal.js.snap index 78495dff8339c..7ad7a0ad6f6c0 100644 --- a/packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeEvents-test.internal.js.snap +++ b/packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeEvents-test.internal.js.snap @@ -7,6 +7,6 @@ exports[`fails if unknown/unsupported event types are dispatched 1`] = ` exports[`handles events 1`] = ` " {} - View {\\"foo\\":\\"outer\\"} - View {\\"foo\\":\\"inner\\"}" + View {"foo":"outer"} + View {"foo":"inner"}" `; diff --git a/packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeMount-test.internal.js.snap b/packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeMount-test.internal.js.snap index 9cf7df921746b..0bd001c8f4b08 100644 --- a/packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeMount-test.internal.js.snap +++ b/packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeMount-test.internal.js.snap @@ -3,49 +3,49 @@ exports[`ReactNative renders and reorders children 1`] = ` " {} RCTView null - RCTView {\\"title\\":\\"a\\"} - RCTView {\\"title\\":\\"b\\"} - RCTView {\\"title\\":\\"c\\"} - RCTView {\\"title\\":\\"d\\"} - RCTView {\\"title\\":\\"e\\"} - RCTView {\\"title\\":\\"f\\"} - RCTView {\\"title\\":\\"g\\"} - RCTView {\\"title\\":\\"h\\"} - RCTView {\\"title\\":\\"i\\"} - RCTView {\\"title\\":\\"j\\"} - RCTView {\\"title\\":\\"k\\"} - RCTView {\\"title\\":\\"l\\"} - RCTView {\\"title\\":\\"m\\"} - RCTView {\\"title\\":\\"n\\"} - RCTView {\\"title\\":\\"o\\"} - RCTView {\\"title\\":\\"p\\"} - RCTView {\\"title\\":\\"q\\"} - RCTView {\\"title\\":\\"r\\"} - RCTView {\\"title\\":\\"s\\"} - RCTView {\\"title\\":\\"t\\"}" + RCTView {"title":"a"} + RCTView {"title":"b"} + RCTView {"title":"c"} + RCTView {"title":"d"} + RCTView {"title":"e"} + RCTView {"title":"f"} + RCTView {"title":"g"} + RCTView {"title":"h"} + RCTView {"title":"i"} + RCTView {"title":"j"} + RCTView {"title":"k"} + RCTView {"title":"l"} + RCTView {"title":"m"} + RCTView {"title":"n"} + RCTView {"title":"o"} + RCTView {"title":"p"} + RCTView {"title":"q"} + RCTView {"title":"r"} + RCTView {"title":"s"} + RCTView {"title":"t"}" `; exports[`ReactNative renders and reorders children 2`] = ` " {} RCTView null - RCTView {\\"title\\":\\"m\\"} - RCTView {\\"title\\":\\"x\\"} - RCTView {\\"title\\":\\"h\\"} - RCTView {\\"title\\":\\"p\\"} - RCTView {\\"title\\":\\"g\\"} - RCTView {\\"title\\":\\"w\\"} - RCTView {\\"title\\":\\"f\\"} - RCTView {\\"title\\":\\"r\\"} - RCTView {\\"title\\":\\"a\\"} - RCTView {\\"title\\":\\"l\\"} - RCTView {\\"title\\":\\"k\\"} - RCTView {\\"title\\":\\"e\\"} - RCTView {\\"title\\":\\"o\\"} - RCTView {\\"title\\":\\"i\\"} - RCTView {\\"title\\":\\"v\\"} - RCTView {\\"title\\":\\"c\\"} - RCTView {\\"title\\":\\"s\\"} - RCTView {\\"title\\":\\"t\\"} - RCTView {\\"title\\":\\"z\\"} - RCTView {\\"title\\":\\"y\\"}" + RCTView {"title":"m"} + RCTView {"title":"x"} + RCTView {"title":"h"} + RCTView {"title":"p"} + RCTView {"title":"g"} + RCTView {"title":"w"} + RCTView {"title":"f"} + RCTView {"title":"r"} + RCTView {"title":"a"} + RCTView {"title":"l"} + RCTView {"title":"k"} + RCTView {"title":"e"} + RCTView {"title":"o"} + RCTView {"title":"i"} + RCTView {"title":"v"} + RCTView {"title":"c"} + RCTView {"title":"s"} + RCTView {"title":"t"} + RCTView {"title":"z"} + RCTView {"title":"y"}" `; diff --git a/packages/react-server-dom-relay/src/__tests__/ReactDOMServerFB-test.internal.js b/packages/react-server-dom-relay/src/__tests__/ReactDOMServerFB-test.internal.js index 150aa47727349..d3267ebdb5db0 100644 --- a/packages/react-server-dom-relay/src/__tests__/ReactDOMServerFB-test.internal.js +++ b/packages/react-server-dom-relay/src/__tests__/ReactDOMServerFB-test.internal.js @@ -59,7 +59,7 @@ describe('ReactDOMServerFB', () => { }); const result = readResult(stream); expect(result).toMatchInlineSnapshot( - `"
hello world
"`, + `"
hello world
"`, ); }); diff --git a/packages/react-server-native-relay/src/__tests__/__snapshots__/ReactFlightNativeRelay-test.internal.js.snap b/packages/react-server-native-relay/src/__tests__/__snapshots__/ReactFlightNativeRelay-test.internal.js.snap index cdeab0b8fb471..5184a033b3a3a 100644 --- a/packages/react-server-native-relay/src/__tests__/__snapshots__/ReactFlightNativeRelay-test.internal.js.snap +++ b/packages/react-server-native-relay/src/__tests__/__snapshots__/ReactFlightNativeRelay-test.internal.js.snap @@ -3,9 +3,9 @@ exports[`ReactFlightNativeRelay can render a Client Component using a module reference and render there 1`] = ` "1 RCTText null - RCTRawText {\\"text\\":\\"Hello\\"} - RCTRawText {\\"text\\":\\", \\"} - RCTRawText {\\"text\\":\\"Seb Smith\\"}" + RCTRawText {"text":"Hello"} + RCTRawText {"text":", "} + RCTRawText {"text":"Seb Smith"}" `; exports[`ReactFlightNativeRelay can render a Server Component 1`] = ` diff --git a/packages/react/src/__tests__/ReactFetch-test.js b/packages/react/src/__tests__/ReactFetch-test.js index 753cb03324991..2993ed564cdbd 100644 --- a/packages/react/src/__tests__/ReactFetch-test.js +++ b/packages/react/src/__tests__/ReactFetch-test.js @@ -183,7 +183,7 @@ describe('ReactFetch', () => { return text + ' ' + text2; } expect(await render(Component)).toMatchInlineSnapshot( - `"GET world [[\\"a\\",\\"A\\"]] GET world [[\\"b\\",\\"B\\"]]"`, + `"GET world [["a","A"]] GET world [["b","B"]]"`, ); expect(fetchCount).toBe(2); }); diff --git a/scripts/error-codes/__tests__/__snapshots__/transform-error-messages.js.snap b/scripts/error-codes/__tests__/__snapshots__/transform-error-messages.js.snap index 924dcdfa91f86..878b92da0aee3 100644 --- a/scripts/error-codes/__tests__/__snapshots__/transform-error-messages.js.snap +++ b/scripts/error-codes/__tests__/__snapshots__/transform-error-messages.js.snap @@ -11,14 +11,14 @@ b, new Error('foo')));" `; exports[`error transform handles escaped backticks in template string 1`] = ` -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; +"import _formatProdErrorMessage from "shared/formatProdErrorMessage"; Error(_formatProdErrorMessage(231, listener, type));" `; exports[`error transform handles ignoring errors that are comment-excluded inside ternary expressions 1`] = ` "/*! FIXME (minify-errors-in-prod): Unminified error message in production build!*/ -/*! \\"bar\\"*/ +/*! "bar"*/ var val = someBool ? //eslint-disable-next-line react-internal/prod-error-codes new Error('foo') : someOtherBool ? new Error('bar') : //eslint-disable-next-line react-internal/prod-error-codes new Error('baz');" @@ -37,7 +37,7 @@ NotAnError();" exports[`error transform should output FIXME for errors that don't have a matching error code 1`] = ` "/*! FIXME (minify-errors-in-prod): Unminified error message in production build!*/ -/*! \\"This is not a real error message.\\"*/ +/*! "This is not a real error message."*/ Error('This is not a real error message.');" `; @@ -47,26 +47,26 @@ Error('This is not a real error message.');" `; exports[`error transform should replace error constructors (no new) 1`] = ` -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; +"import _formatProdErrorMessage from "shared/formatProdErrorMessage"; Error(_formatProdErrorMessage(16));" `; exports[`error transform should replace error constructors 1`] = ` -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; +"import _formatProdErrorMessage from "shared/formatProdErrorMessage"; Error(_formatProdErrorMessage(16));" `; exports[`error transform should support error constructors with concatenated messages 1`] = ` -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; +"import _formatProdErrorMessage from "shared/formatProdErrorMessage"; Error(_formatProdErrorMessage(7, foo, bar));" `; exports[`error transform should support interpolating arguments with concatenation 1`] = ` -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; +"import _formatProdErrorMessage from "shared/formatProdErrorMessage"; Error(_formatProdErrorMessage(7, foo, bar));" `; exports[`error transform should support interpolating arguments with template strings 1`] = ` -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; +"import _formatProdErrorMessage from "shared/formatProdErrorMessage"; Error(_formatProdErrorMessage(7, foo, bar));" `; diff --git a/scripts/jest/config.base.js b/scripts/jest/config.base.js index 2ac534c41c05d..e7deaa4ecb6ba 100644 --- a/scripts/jest/config.base.js +++ b/scripts/jest/config.base.js @@ -25,7 +25,6 @@ module.exports = { legacyFakeTimers: true, }, snapshotFormat: { - escapeString: true, printBasicPrototype: true, }, snapshotSerializers: [require.resolve('jest-snapshot-serializer-raw')],