-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a test harness for running node fs parity tests #630
Comments
Looked at node's test approach, and one thing they have is a Here's an example of it being used, where all test operations happen rooted in the https://github.com/nodejs/node/blob/master/test/parallel/test-fs-chmod.js#L74-L75 Tests seem to clear up the |
https://github.com/metarhia/sandboxed-fs is interesting, for locking |
I had a thought: why don't we have a set of tests that run a set of operations on node's
fs
, collect the results (e.g., errors, returned data), then run the identical set of operations onFiler
+MemoryProvider
. Doing so, we should expect that in most cases, Filer should behave in the same way asfs
.There are lots of places where we can't be 100% identical (e.g., sync methods), so we'll never be able to run the entire node
fs
test suite. However, we're not supposed to let perfect be the enemy of the good, right?We can do most of what
fs
does, and it would be nice if we did the same thing as node whenever possible. These tests would be something like ref or snapshot tests, in that you'd expect the same behaviour from two implementations.I think doing this involves the following:
tests/
, maybetest/node-parity
fs
operations without corrupting the user's actual filesystem. node.js must have done something with this already, or the node tests could trash your filesystem. Things like deleting huge amounts of files/directories, filling the disk, etc. are a no-go.fs
andFiler
into the same initial state for tests can run without modification on both implementations. For example, Filer tests often start from/
, but that's insane forfs
. We'd need some kind ofbefore
setup code to create temp dirs or the like, and use the root paths for both sets of test runs.fs
.mocha tests/node-parity/**/*.js
in node (not browser).The text was updated successfully, but these errors were encountered: