remove use of experimental fs.promises api (#53346) (#53796)

* remove use of experimental fs.promises api

* remove one more usage of fs.promises

* switch to an alternate fs module to maintain testing strategy

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Spencer 2019-12-25 21:28:41 -07:00 committed by GitHub
parent 88f8bef2fd
commit dbf1c3c8cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 20 deletions

View file

@ -103,8 +103,8 @@ async function compareScreenshots() {
const diffImagePath = path.resolve(DIFF_SCREENSHOTS_DIR, screenshot);
const sessionImage = PNG.sync.read(await fs.promises.readFile(sessionImagePath));
const baselineImage = PNG.sync.read(await fs.promises.readFile(baselineImagePath));
const sessionImage = PNG.sync.read(await readFileAsync(sessionImagePath));
const baselineImage = PNG.sync.read(await readFileAsync(baselineImagePath));
const { width, height } = sessionImage;
const diff = new PNG({ width, height });
@ -117,7 +117,7 @@ async function compareScreenshots() {
{ threshold: 0 }
);
await fs.promises.writeFile(diffImagePath, PNG.sync.write(diff));
await writeFileAsync(diffImagePath, PNG.sync.write(diff));
const change = numDiffPixels / (width * height);
const changePercentage = (change * 100).toFixed(2);