Skip to content

CLI commands don't work on Windows due to path issue #96

@SnezhG

Description

@SnezhG

I'm using v0.10.0 of the library on Windows 10

When running commands

pdf-visual-diff approve
pdf-visual-diff discard

they fail to find any snapshot files

After some debugging i think i found the problem. glob expects forward slashes (/), but path uses backslashes (\)

I fixed the issue locally by modifying this line in file lib/cli/utils.js

const pattern = path.join(process.cwd(), startingPath, '**', snapshotsDirName, filenamePatter);

to

 const pattern = path.join(process.cwd(), startingPath, '**', snapshotsDirName, filenamePatter).replace(/\\/g, '/');

After this the commands started working correctly and finds snapshot filed
Can this fix be added to the repo to support Windows?
Let me know if you'd like me to submit 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