-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The tests were initially super slow, as the PNG.sync.write took up to 20 seconds. This seems to be related to jest [1][2]. I therefore added Math to the sandboxInjectedGlobals to speed things up. [1] pngjs/pngjs#96 [2] jestjs/jest#5163 (comment)
- Loading branch information
Showing
8 changed files
with
53 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
testdata |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import fs from "fs/promises"; | ||
import { compare } from "./compare.js"; | ||
|
||
describe("compare", () => { | ||
it("returns the number of pixels that differ", async () => { | ||
let expected = await fs.readFile("testdata/simple-expected.png"); | ||
let actual = await fs.readFile("testdata/simple-actual.png"); | ||
let expectedDiff = await fs.readFile("testdata/simple-diff.png"); | ||
|
||
let result = await compare(expected, actual); | ||
|
||
expect(result.numDiffPixels).toBe(152); | ||
expect(result.expected).toStrictEqual(expected); | ||
expect(result.actual).toStrictEqual(actual); | ||
expect(result.diff).toStrictEqual(expectedDiff); | ||
}); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.