Skip to content

mtimeMs comparison is broken in node v14.17.0 #83

@gavinaiken

Description

@gavinaiken

In node v14.17.0 on Mac OSX Catalina I am seeing an issue where gulp-changed always detects the source file as changed because the target is getting an mtimeMs slightly behind that of the source file when gulp creates it. This problem did not exist in v14.16.1.

The comparison happens here: https://github.com/sindresorhus/gulp-changed/blob/main/index.js#L28 and I am seeing mtimes for example like this:

sourceFile.stat.mtimeMs: 1621590505837.191
targetStat.mtimeMs:  1621590505836.999

Previously the target mtime would be eg 1621590505837 so the two floor comparisons would work fine.

A simple work-around for this is to use floor for the source and ceil for the target, which resolves the issue for me. I will provide a PR with this change.

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