fsevents 不是函数,而 运行 在 React-Testing-Library 上进行初始测试
fsevents is not a function while running initial test on React-Testing-Library
我是 React-Testing-Library 的新手,我收到以下错误:
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! post@0.1.0 test: react-scripts test
npm ERR!
Exit status 1 npm ERR! Failed at the post@0.1.0 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:
这是我的代码:
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();
})
删除 node_modules
文件夹和 package-lock.json
文件并再次执行 npm install
。
我是 React-Testing-Library 的新手,我收到以下错误:
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! post@0.1.0 test:
react-scripts test
npm ERR! Exit status 1 npm ERR! Failed at the post@0.1.0 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:
这是我的代码:
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();
})
删除 node_modules
文件夹和 package-lock.json
文件并再次执行 npm install
。