Here, I am doing unit testing on some component in my reactjs application through enzyme.But after firing npm test command it gives an error and I don't know what is that error and how can solve it. Please help me to solve this error. Here, I attach test.js file and console output.
NavigationItems.test.js:
import React from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import NavigationItems from './NavigationItems';
import NavigationItem from './NavigationItem/NavigationItem';
configure({adapter: new Adapter()});
describe('<NavigationItems />', () => {
let wrapper;
beforeEach(() => {
wrapper = shallow(<NavigationItems />);
});
it('should render two <NavigationItem /> elements if not authenticated', () => {
expect(wrapper.find(NavigationItem)).toHaveLength(2);
});
it('should render three <NavigationItem /> elements if authenticated', () => {
//const wrapper = shallow(<NavigationItems isAuthenticated />);
wrapper.setProps({isAuthenticated: true});
expect(wrapper.find(NavigationItem)).toHaveLength(3);
}); });
Console Output:
abc-17@abc17-B250M-D2V:~/bb1$ npm test
> burger-builder@0.1.0 test /home/abc-17/bb1
> node scripts/test.js --env=jsdom
fs.js:1384
throw error;
^
Error: watch /home/abc-17/bb1/node_modules/lodash.uniq ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at NodeWatcher.watchdir (/home/abc-17/bb1/node_modules/sane/src/node_watcher.js:150:20)
at Walker.<anonymous> (/home/abc-17/bb1/node_modules/sane/src/node_watcher.js:374:12)
at emitTwo (events.js:126:13)
at Walker.emit (events.js:214:7)
at /home/abc-17/bb1/node_modules/walker/lib/walker.js:69:16
at go$readdir$cb (/home/abc-17/bb1/node_modules/graceful-fs/graceful-fs.js:149:14)
at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! Test failed. See above for more details.
Aucun commentaire:
Enregistrer un commentaire