Mock file system in Node.js
github.com
Mock file system in Node.js
1–6 of 6 posts
Re: Mock file system in Node.js
#2Re: Mock file system in Node.js
#3Can someone give me an example of why I'd want this?
Re: Mock file system in Node.js
#4Can someone give me an example of why I'd want this?
Re: Mock file system in Node.js
#5Re: Mock file system in Node.js
#6Can someone give me an example of why I'd want this?
Sometime we just want to test some simple file handling functions, and don't want to create real files and directories because:
It's annoying to remember to remove test files and directories after tests
It's annoying to fill the content of dummy files with file APIs
Forgot to delete files after test may cause some troubles
Tests should completely live within sandbox. Create files and directories may cause side-effects on your system
If your dummy files and directories got affected by other processes on your system, you may have no chance to know what's going wrong with your tests
So I create this to implement a filesystem in process memory, and a mocked fs module which has some compatible APIs.