react-mock icon indicating copy to clipboard operation
react-mock copied to clipboard

Following installing fetch mock i get SyntaxError: Cannot use import statement outside a module

Open lior-amsalem opened this issue 3 years ago • 0 comments

after i install @react-mock/fetch than run npm test (with create react app setup) i get this error:

    import http from 'node:http';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

snippet code:

import { FetchMock } from '@react-mock/fetch';

//..
render(
    <FetchMock options={{ matcher: 'https://my-server/api/', response: [{ id: 123 }], method: 'GET' }}>
      <AppWrapper />
    </FetchMock>
    );

lior-amsalem avatar Dec 04 '21 12:12 lior-amsalem