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

Support slashes in fileNameFormatter #275

Closed
kurttomlinson opened this issue Oct 9, 2020 · 1 comment
Closed

Support slashes in fileNameFormatter #275

kurttomlinson opened this issue Oct 9, 2020 · 1 comment

Comments

@kurttomlinson
Copy link
Contributor

I'm attempting to put my screenshots in a non-flat file structure. I've added a fileNameFormatter to my loki configuration. It works great when running loki update.

However, if I make a change to a component and then run loki test, I get an ENOENT: no such file or directory error:

 FAIL  chrome.docker/chrome.laptop/templates/LocationServiceTemplate/RelatedLinks
       Base
       ENOENT: no such file or directory, open '/Users/ktomlinson/src/v3/packages/marketing-pages/.loki/difference/chrome.laptop/templates/locationservicetemplate/relatedlinks base.png'

I'm guessing that Loki is not creating the directory that the difference file is going to go into before attempting to create the file. This can probably be fixed by adding a mkdir -p right before writing the difference file to disk.

Here's my Loki configuration file. Note I'm using the exact fileNameFormatter function that's used as an example in the documentation.

// loki.config.js

function fileNameFormatter({ configurationName, kind, story }) {
  return `${configurationName}/${kind} ${story}`.toLowerCase();
}

module.exports = {
  fileNameFormatter,
  diffingEngine: "looks-same",
  "looks-same": {
    tolerance: 3,
  },
  configurations: {
    "chrome.laptop": {
      target: "chrome.docker",
      width: 1366,
      height: 768,
      deviceScaleFactor: 1,
      mobile: false,
    },
    "chrome.ipad": {
      target: "chrome.docker",
      width: 768,
      height: 1024,
      deviceScaleFactor: 2,
      mobile: true,
    },
    "chrome.iphone5": {
      target: "chrome.docker",
      preset: "iPhone 5",
    },
  },
};
@techeverri
Copy link
Collaborator

Duplicate of #229

@techeverri techeverri marked this as a duplicate of #229 Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants