Skip to content

Jest Test in Create-React-App broken #215

@Firionus

Description

@Firionus

Title

  • bug: Jest Test in Create-React-App broken with TypeError: tabulator_tables_1.default is not a constructor

Environment Details

  • react-tabulator version: 0.14.2
  • OS: Windows 10
  • Node.js version: 14.5.1 (latest LTS)

Long Description
To reproduce:

Result:

(node:9100) UnhandledPromiseRejectionWarning: TypeError: tabulator_tables_1.default is not a constructor
(node:9100) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:9100) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
 PASS  src/App.test.tsx
  √ renders learn react link (45 ms)

Expected Result: No Warnings

Test can even be made to fail by making it async:

test('renders learn react link', async () => {
  render(<App />);
  const linkElement = screen.getByText(/learn react/i);
  expect(linkElement).toBeInTheDocument();
  await waitFor(() => {
    expect(screen.queryByText("nowhere to be found")).not.toBeInTheDocument();
  });
});

yielding the test result:

 FAIL  src/App.test.tsx
  × renders learn react link (46 ms)

  ● renders learn react link

    TypeError: tabulator_tables_1.default is not a constructor

      at default_1.<anonymous> (node_modules/react-tabulator/lib/ReactTabulator.js:111:25)
      at step (node_modules/react-tabulator/lib/ReactTabulator.js:57:23)
      at Object.next (node_modules/react-tabulator/lib/ReactTabulator.js:38:53)
      at fulfilled (node_modules/react-tabulator/lib/ReactTabulator.js:29:58)

Unfortunately, the test works in Codesandbox (https://codesandbox.io/s/vr3in).

Workaround

No idea right now.

Related Issue
#204

I tried npm cache clean --force, followed by deleting node_modules and npm install, but npm test still gives the same FAIL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions