Skip to content

Commit

Permalink
Use graceful-fs in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Dec 19, 2024
1 parent 5f27144 commit a32188f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"ava": "^6.2.0",
"eslint": "^9.17.0",
"globals": "^15.14.0",
"graceful-fs": "^4.2.11",
"pixelmatch": "^5.3.0"
},
"ava": {
Expand Down
4 changes: 1 addition & 3 deletions src/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Image {
opts.sourceUrl = this.src.toString();
opts.__originalSize = this.src.length;
} else {
// TODO @zachleat (multiread): another read
// Important: do not cache this
opts.__originalSize = fs.statSync(this.src).size;
}

Expand Down Expand Up @@ -143,7 +143,6 @@ class Image {
}
}


return this.#contents[src];
}

Expand Down Expand Up @@ -300,7 +299,6 @@ class Image {
// fetch remote image Buffer
this.inputPromise = this.assetCache.queue();
} else {
// TODO @zachleat (multiread): read local file contents here and always return a buffer
this.inputPromise = Promise.resolve(this.src);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require("node:path");
const fs = require("node:fs");
const fs = require("graceful-fs");
const { URL } = require("node:url");

const test = require("ava");
Expand Down

0 comments on commit a32188f

Please sign in to comment.