Repository: facebook/react
File: packages/react-client/src/__tests__/ReactFlight-test.js (JavaScript)

Code before:
        <ClientErrorBoundary expectedMessage="undefined">
          <div>
            <Throw value={undefined} />
          </div>
        </ClientErrorBoundary>
        <ClientErrorBoundary expectedMessage="<div/>">
          <div>
            <Throw value={<div />} />
          </div>
        </ClientErrorBoundary>
        <ClientErrorBoundary expectedMessage="function Foo() {}">
          <div>
            <Throw value={function Foo() {}} />
          </div>
        </ClientErrorBoundary>
        <ClientErrorBoundary expectedMessage={'["array"]'}>
          <div>
            <Throw value={['array']} />
          </div>
        </ClientErrorBoundary>
        <ClientErrorBoundary
          expectedMessage={
            'A React Element from an older version of React was rendered. ' +
            'This is not supported. It can happen if:\n' +
            '- Multiple copies of the "react" package is used.\n' +
            '- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n' +
            '- A compiler tries to "inline" JSX instead of using the runtime.'
          }>
          <div>
            <LazyInlined />
          </div>
        </ClientErrorBoundary>
      </>
    );

    const transport = ReactNoopFlightServer.render(testCases, {
      onError(x) {
        if (__DEV__) {
          return 'a dev digest';
        }
        if (x instanceof Error) {
          return `digest("${x.message}")`;
        } else if (Array.isArray(x)) {
          return `digest([])`;
        } else if (typeof x === 'object' && x !== null) {
          return `digest({})`;
        }
        return `digest(${String(x)})`;
      },
    });


Review comment (suggestion):
```suggestion
            '- Multiple copies of the "react" package are used.\n' +
```

Code after:
        </ClientErrorBoundary>
        <ClientErrorBoundary expectedMessage="undefined">
          <div>
            <Throw value={undefined} />
          </div>
        </ClientErrorBoundary>
        <ClientErrorBoundary expectedMessage="<div/>">
          <div>
            <Throw value={<div />} />
          </div>
        </ClientErrorBoundary>
        <ClientErrorBoundary expectedMessage="function Foo() {}">
          <div>
            <Throw value={function Foo() {}} />
          </div>
        </ClientErrorBoundary>
        <ClientErrorBoundary expectedMessage={'["array"]'}>
          <div>
            <Throw value={['array']} />
          </div>
        </ClientErrorBoundary>
        <ClientErrorBoundary
          expectedMessage={
            'A React Element from an older version of React was rendered. ' +
            'This is not supported. It can happen if:\n' +
            '- Multiple copies of the "react" package is used.\n' +
            '- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n' +
            '- A compiler tries to "inline" JSX instead of using the runtime.'
          }>
          <div>
            <LazyInlined />
          </div>
        </ClientErrorBoundary>
      </>
    );

    const transport = ReactNoopFlightServer.render(testCases, {
      onError(x) {
        if (__DEV__) {
          return 'a dev digest';
        }
        if (x instanceof Error) {
          return `digest("${x.message}")`;
        } else if (Array.isArray(x)) {
          return `digest([])`;
        } else if (typeof x === 'object' && x !== null) {
          return `digest({})`;
        }
        return `digest(${String(x)})`;
      },
    });