with-local-tmp-dir
Creates a temporary folder inside cwd, cds inside the folder, runs a function, and removes the folder. Especially useful for testing. (by dword-design)
mock-fs
Configurable mock for the fs module (by tschaub)
Our great sponsors
with-local-tmp-dir | mock-fs | |
---|---|---|
1 | 2 | |
4 | 896 | |
- | - | |
4.9 | 0.0 | |
about 2 months ago | 7 months ago | |
JavaScript | JavaScript | |
GNU General Public License v3.0 or later | GNU General Public License v3.0 or later |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
with-local-tmp-dir
Posts with mentions or reviews of with-local-tmp-dir.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2021-04-21.
-
How to Write File-Based Tests With Real Files
Why not use real files for testing instead of mocking? I built an NPM package called with-local-tmp-dir that basically creates a temporary subfolder inside cwd, cds into it, runs a function, and cds back to the previous cwd afterwards. In this function you can create files and pretty much anything, run your unit under test. Afterwards the folder is removed and everything is cleaned up. You actually do not solely need to use it for tests, you can use it anywhere, but it's mostly useful for tests.
mock-fs
Posts with mentions or reviews of mock-fs.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2021-04-21.
-
How to Write File-Based Tests With Real Files
A lot of my past projects in some way had to do with file access. I started to test with mocking libraries like mock-fs, but soon recognized that they do not work for all cases, and sometimes you are using third party libraries internally that you cannot mock easily. So I thought of a different solution and the one I'm using right now for most projects actually uses real files.
-
Unit testing Node.js fs with mock-fs
In this post I'll be showing you how you can use mock-fs to easily unit test your Node.js scripts.
What are some alternatives?
When comparing with-local-tmp-dir and mock-fs you can also consider the following projects:
output-files - Output a tree of files and directories by providing an object. Especially useful for testing with real files.
fs-extra - Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
jest - Delightful JavaScript Testing.
mocha - ☕️ simple, flexible, fun javascript test framework for node.js & the browser
expect - Write better assertions
endent - ⬅️ An ES6 string tag makes indentation better
react-native-localhost - ⚛️ 🏡 Returns the local address of your actual development machine.
with-local-tmp-dir vs output-files
mock-fs vs fs-extra
with-local-tmp-dir vs jest
mock-fs vs jest
with-local-tmp-dir vs mocha
mock-fs vs mocha
with-local-tmp-dir vs expect
mock-fs vs output-files
with-local-tmp-dir vs endent
mock-fs vs endent
with-local-tmp-dir vs fs-extra
with-local-tmp-dir vs react-native-localhost