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

returns false with fs.lstatSync(path).isDirectory() over a directory with node 8.2.1 #215

Closed
omarcinp opened this issue Aug 4, 2017 · 3 comments

Comments

@omarcinp
Copy link

omarcinp commented Aug 4, 2017

given the following code...


const FAKE_EMPTY_PATH = 'fake-empty-path';
const FAKE_PATH = 'fake-path';
const FAKE_JSON_FILE_NAME = 'publication';
const FAKE_TEXT_FILE_NAME = 'myfile';
const FAKE_PATH_2 = 'fake-path-2';


const FAKE_OBJECT_CONTENT = {
  key: "value"
};

const STUB_CONTENT = {
  key1: "value1",
  key2: "value2",
}

const FAKE_TEXT_CONTENT = 'this is an string content';

const mockOptions = {
  [FAKE_EMPTY_PATH]: {},
  [FAKE_PATH]: {
    [FAKE_JSON_FILE_NAME]: JSON.stringify(FAKE_OBJECT_CONTENT),
    [FAKE_TEXT_FILE_NAME]: FAKE_TEXT_CONTENT,
    anotherFile: '{}'
  },
  [FAKE_PATH_2]: {
    [FAKE_JSON_FILE_NAME]: STUB_CONTENT
  }

};

mockFS(mockOptions);
const stat = fs.lstatSync(path);
const isDirectory = stat.isDirectory(); // false in node 8.2.1, true in node 7.9.0

@emolr
Copy link

emolr commented Sep 7, 2017

+1

I wish i could figure out what is the cause of this, but i can't seem to figure it out

@bencoveney
Copy link

This has been fixed in my library by updating to the latest mock-fs version.

@3cp
Copy link
Collaborator

3cp commented May 29, 2020

Confirm fixed in latest version.

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

No branches or pull requests

4 participants