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

The "path" argument must be of type string. Received undefined #300

Closed
simonsmith opened this issue Jun 17, 2022 · 3 comments · Fixed by #306
Closed

The "path" argument must be of type string. Received undefined #300

simonsmith opened this issue Jun 17, 2022 · 3 comments · Fixed by #306
Labels

Comments

@simonsmith
Copy link

simonsmith commented Jun 17, 2022

I believe a breaking change was introduced in #298

The diffImageToSnapshot function now accepts what appears to be an optional receivedDir prop but it has no default value so if I update from 5.0.0 to 5.1.0 I now get the above error because undefined is passed to path.join here:

const receivedSnapshotPath = path.join(receivedDir, `${snapshotIdentifier}-received.png`);

For reference, here is how I was calling it before so you can see how receivedDir is undefined

  snapshotResult = diffImageToSnapshot({
    snapshotsDir,
    diffDir,
    receivedImageBuffer,
    snapshotIdentifier,
    failureThreshold,
    failureThresholdType,
    updateSnapshot: updateSnapshots,
    ...options,
  });

I think that change should either be

  • a required argument and a 6.0.0 release
  • have some sort of check so it can be optional when not passed

For now, staying on 5.0.0 resolves it

Thanks!

@MirandaBrawnerSavannah
Copy link

Did you resolve this issue? If not, do you want me to work on it?

@simonsmith
Copy link
Author

I just found a workaround, which was to stay on 5.0.0 of this library

oneamexbot added a commit that referenced this issue Aug 25, 2022
## [5.1.1](v5.1.0...v5.1.1) (2022-08-25)

### Bug Fixes

* **diff-snapshot:** make recievedDir optional ([#306](#306)) ([cd4fa73](cd4fa73)), closes [#300](#300)
@oneamexbot
Copy link
Contributor

🎉 This issue has been resolved in version 5.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

goverdhan07 pushed a commit to goverdhan07/jest-image-snapshot that referenced this issue Jul 23, 2023
goverdhan07 pushed a commit to goverdhan07/jest-image-snapshot that referenced this issue Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants