Skip to content

Time set incorrectly in Node 12 #276

@knightjdr

Description

@knightjdr

If I use Node 10, I don't encounter any issues. But using Node 12 (specifically 12.10.0), the file times aren't being set correctly.

If I create a file like this:

mockFS.file({
  content: '',
})

fs.stat returns 31 Aug, 51738 for the atime and mtime, and invalid for ctime.

Stats {
  dev: 8675309,
  mode: 33206,
  nlink: 1,
  uid: 501,
  gid: 20,
  rdev: 0,
  blksize: 4096,
  ino: 13,
  size: 0,
  blocks: 0,
  atimeMs: 1570547350139547.2,
  mtimeMs: 1570547350139547.2,
  ctimeMs: NaN,
  birthtimeMs: NaN,
  atime: +051738-08-31T08:48:59.547Z,
  mtime: +051738-08-31T08:48:59.547Z,
  ctime: Invalid Date,
  birthtime: Invalid Date
}

Explicitly setting the atime, ctime, mtime and birthtime has not effect, and produces a similar result.

const now = new Date();
mockFS.file({
  content: '',
  atime: now,
  ctime: now,
  mtime: now,
  birthtime: now,
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions