jest-image-snapshot 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/diff-snapshot.js +1 -1
- package/src/index.js +6 -0
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [6.4.0](https://github.com/americanexpress/jest-image-snapshot/compare/v6.3.0...v6.4.0) (2023-12-11)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add configurable maxBuffer option to runDiffImageToSnapshot ([#344](https://github.com/americanexpress/jest-image-snapshot/issues/344)) ([befad8b](https://github.com/americanexpress/jest-image-snapshot/commit/befad8ba6080be6b0a94d098334ea05258afab2e))
|
7
|
+
|
1
8
|
# [6.3.0](https://github.com/americanexpress/jest-image-snapshot/compare/v6.2.0...v6.3.0) (2023-11-28)
|
2
9
|
|
3
10
|
|
package/README.md
CHANGED
@@ -124,6 +124,7 @@ See [the examples](./examples/README.md) for more detailed usage or read about a
|
|
124
124
|
* `dumpDiffToConsole`: (default `false`) Will output base64 string of a diff image to console in case of failed tests (in addition to creating a diff image). This string can be copy-pasted to a browser address string to preview the diff for a failed test.
|
125
125
|
* `dumpInlineDiffToConsole`: (default `false`) Will output the image to the terminal using iTerm's [Inline Images Protocol](https://iterm2.com/documentation-images.html). If the term is not compatible, it does the same thing as `dumpDiffToConsole`.
|
126
126
|
* `allowSizeMismatch`: (default `false`) If set to true, the build will not fail when the screenshots to compare have different sizes.
|
127
|
+
* `maxChildProcessBufferSizeInBytes`: (default `10 * 1024 * 1024`) Sets the max number of bytes for stdout/stderr when running `diff-snapshot` in a child process.
|
127
128
|
* `runtimeHooksPath`: (default `undefined`) This needs to be set to a existing file, like `require.resolve('./runtimeHooksPath.cjs')`. This file can expose a few hooks:
|
128
129
|
* `onBeforeWriteToDisc`: before saving any image to the disc, this function will be called (can be used to write EXIF data to images for instance)
|
129
130
|
`onBeforeWriteToDisc: (arguments: { buffer: Buffer; destination: string; testPath: string; currentTestName: string }) => Buffer`
|
package/package.json
CHANGED
package/src/diff-snapshot.js
CHANGED
@@ -421,7 +421,7 @@ function runDiffImageToSnapshot(options) {
|
|
421
421
|
{
|
422
422
|
input: Buffer.from(serializedInput),
|
423
423
|
stdio: ['pipe', 'inherit', 'inherit', 'pipe'],
|
424
|
-
maxBuffer:
|
424
|
+
maxBuffer: options.maxChildProcessBufferSizeInBytes,
|
425
425
|
}
|
426
426
|
);
|
427
427
|
|
package/src/index.js
CHANGED
@@ -151,6 +151,10 @@ function configureToMatchImageSnapshot({
|
|
151
151
|
dumpDiffToConsole: commonDumpDiffToConsole = false,
|
152
152
|
dumpInlineDiffToConsole: commonDumpInlineDiffToConsole = false,
|
153
153
|
allowSizeMismatch: commonAllowSizeMismatch = false,
|
154
|
+
// Default to 10 MB instead of node's default 1 MB
|
155
|
+
// See https://nodejs.org/api/child_process.html#child_processspawnsynccommand-args-options
|
156
|
+
maxChildProcessBufferSizeInBytes:
|
157
|
+
commonMaxChildProcessBufferSizeInBytes = 10 * 1024 * 1024, // 10 MB
|
154
158
|
comparisonMethod: commonComparisonMethod = 'pixelmatch',
|
155
159
|
} = {}) {
|
156
160
|
return function toMatchImageSnapshot(received, {
|
@@ -173,6 +177,7 @@ function configureToMatchImageSnapshot({
|
|
173
177
|
dumpDiffToConsole = commonDumpDiffToConsole,
|
174
178
|
dumpInlineDiffToConsole = commonDumpInlineDiffToConsole,
|
175
179
|
allowSizeMismatch = commonAllowSizeMismatch,
|
180
|
+
maxChildProcessBufferSizeInBytes = commonMaxChildProcessBufferSizeInBytes,
|
176
181
|
comparisonMethod = commonComparisonMethod,
|
177
182
|
} = {}) {
|
178
183
|
const {
|
@@ -237,6 +242,7 @@ function configureToMatchImageSnapshot({
|
|
237
242
|
updatePassedSnapshot,
|
238
243
|
blur,
|
239
244
|
allowSizeMismatch,
|
245
|
+
maxChildProcessBufferSizeInBytes,
|
240
246
|
comparisonMethod,
|
241
247
|
runtimeHooksPath,
|
242
248
|
});
|