Possible to use Jimp with mock-fs?
See original GitHub issueI’m using mock-fs to test my project and if I try to include a serialised image byte array as a fixture:
https://github.com/edsilv/biiif/blob/thumbs/test/top.js#L159
Jimp.read
throws this error:
Error: ENOENT, no such file or directory '\\?\c:\Users\edsilv\github\edsilv\biiif\generate-thumbs-manifest\_canvas-without-thumb\file.jpg'
Utils.js:140
unable to generate thumbnail for: c:\generate-thumbs-manifest\_canvas-without-thumb
Other yml fixtures are being read by js-yaml’s safeLoad
. Is Jimp able to work with a mocked filesystem?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Image processing with Node and Jimp - LogRocket Blog
In this tutorial, we'll go over how the library works and describe some common use cases for Jimp image manipulation.
Read more >mock-fs - npm
Start using mock-fs in your project by running `npm i mock-fs`. There are 150 other projects in the npm registry using mock-fs.
Read more >Node.js testing: Using a virtual filesystem as a mock
The mock-fs module streamlines this by letting you provide a simple mapping of paths to file contents and it mostly works.
Read more >Image Processing in Node.js with Jimp - YouTube
In this video, I will be showing you the powerful library Jimp for image manipulation in Node.js Subscribe for more ...
Read more >Unit testing Node.js fs with mock-fs - Emma Goto
Mock your files and folders using mock-fs. We want to be able to mock out some files, because otherwise you would need to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, just having another look at this.
/cat/cat.jpg
passes.c:\cat\cat.jpg
throws“catcat.jpg” - It was to do with using windows backslashes in file paths. Once I normalised these to using forward slashes it started working 😃
Hi, sorry for the delay. Here’s an example project:
https://github.com/edsilv/jimp-mock-fs-error-demo
Annoyingly I can’t install Jimp to test this locally right now because of https://status.npmjs.org/incidents/v22ffls5cd6h - but it should be what you need.