1

I used create-react-app for creating a react app,later built components for my use case.The components I built uses internal company libraries.I started writing tests.I wrote a simple test which will just render the component. Components which does not use internal libraries are working fine when I imported them in a test file and rendered, but the components which use internal libraries are throwing this error SyntaxError: Cannot use import statement outside a module pointing to the import statement of internal library used in the component.Can someone help me in solving this issue. Note: I am new to react and used create-react-app.This the code in test file

import React from 'react';
import { render } from '@testing-library/react';
import Detailpage from '../Detailpage';

test('renders detailpage', () => {
  render(<Detailpage />);
});
  • Does this answer your question? [How to resolve "Cannot use import statement outside a module" in jest](https://stackoverflow.com/questions/58613492/how-to-resolve-cannot-use-import-statement-outside-a-module-in-jest) – juliomalves Apr 08 '21 at 20:00

0 Answers0