EverydayDeveloper
EverydayDeveloper

Reputation: 1150

fsevents is not a function while running initial test on React-Testing-Library

I am new to React-Testing-Library and I am getting the following error:

TypeError: fsevents is not a function

at new FSEventsWatcher (/Users/abc/Desktop/PostIt/node_modules/jest-haste-map/build/lib/FSEventsWatcher.js:162:20)
at createWatcher (/Users/abc/Desktop/PostIt/node_modules/jest-haste-map/build/index.js:1052:23)
at Array.map (<anonymous>)
at HasteMap._watch (/Users/abc/Desktop/PostIt/node_modules/jest-haste-map/build/index.js:1230:44)
at /Users/abc/Desktop/PostIt/node_modules/jest-haste-map/build/index.js:517:21
at Generator.next (<anonymous>)
at asyncGeneratorStep (/Users/abc/Desktop/PostIt/node_modules/jest-haste-map/build/index.js:193:24)
at _next (/Users/abc/Desktop/PostIt/node_modules/jest-haste-map/build/index.js:213:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5) npm ERR! code ELIFECYCLE npm

ERR! errno 1 npm ERR! [email protected] test: react-scripts test npm ERR! Exit status 1 npm ERR! Failed at the [email protected] test script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in:

Here is my code:

import React from 'react';
import { render, fireEvent, waitForElement, cleanup } from '@testing-library/react';
import App from './App';
import '@testing-library/jest-dom/extend-expect'
afterEach(cleanup)

test('make sure that I can submit a question', async () => {
  const {debug} = render(
    <App />
  ) 
debug();
})

Upvotes: 1

Views: 2019

Answers (1)

Ashish Kumar
Ashish Kumar

Reputation: 166

Remove node_modules folder and package-lock.json file and do npm install again.

Upvotes: 3

Related Questions