Skip to content
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

Support for Promises #202

Open
kinsi55 opened this issue Jun 26, 2020 · 1 comment · May be fixed by #217
Open

Support for Promises #202

kinsi55 opened this issue Jun 26, 2020 · 1 comment · May be fixed by #217

Comments

@kinsi55
Copy link

kinsi55 commented Jun 26, 2020

I'm using the patchFS method in combination with unionfs / memfs, and while I get the expected result when using Sync / callback style methods, the fs.promises.X methods seem to be untouched. I'm guessing this is an oversight since the patching code ignores the promises object.

Example:

const Fs = require("fs");

const {ufs} = require("unionfs");
const {vol} = require("memfs");
const {patchFs} = require("fs-monkey");

const MockedFs = {"foo.bar": ""};

vol.fromJSON(MockedFs);

ufs.use({...require("fs")}).use(vol);
patchFs(ufs);

Fs.accessSync("foo.bar") // Undefined, aka accessible

Fs.promises.access("foo.bar").then(console.log).catch(console.error) // Fails, foo.bar not found

ufs.promises.access("foo.bar").then(console.log).catch(console.error) // As expected, doesnt error (Accessible)
@aleung aleung linked a pull request Feb 9, 2021 that will close this issue
@aleung
Copy link

aleung commented Feb 9, 2021

You can use my fork @aleung/fs-monkey temporary until #217 got merged and published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants