jest-image-snapshot 4.0.1 → 4.0.2

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.0.2](https://github.com/americanexpress/jest-image-snapshot/compare/v4.0.1...v4.0.2) (2020-05-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **options:** auto-detect colors if noColors option is not specified ([d90298c](https://github.com/americanexpress/jest-image-snapshot/commit/d90298c3f102734107a7574ddf0516c19a349c66))
7
+
1
8
  ## [4.0.1](https://github.com/americanexpress/jest-image-snapshot/compare/v4.0.0...v4.0.1) (2020-05-27)
2
9
 
3
10
 
package/README.md CHANGED
@@ -107,7 +107,7 @@ See [the examples](./examples/README.md) for more detailed usage or read about a
107
107
  * `customDiffDir`: A custom absolute path of a directory to keep this diff in
108
108
  * `customSnapshotIdentifier`: A custom name to give this snapshot. If not provided one is computed automatically. When a function is provided it is called with an object containing `testPath`, `currentTestName`, `counter` and `defaultIdentifier` as its first argument. The function must return an identifier to use for the snapshot.
109
109
  * `diffDirection`: (default: `horizontal`) (options `horizontal` or `vertical`) Changes diff image layout direction
110
- * `noColors`: (default `false`) Removes coloring from console output, useful if storing the results in a file
110
+ * `noColors`: Removes coloring from console output, useful if storing the results in a file
111
111
  * `failureThreshold`: (default `0`) Sets the threshold that would trigger a test failure based on the `failureThresholdType` selected. This is different to the `customDiffConfig.threshold` above, that is the per pixel failure threshold, this is the failure threshold for the entire comparison.
112
112
  * `failureThresholdType`: (default `pixel`) (options `percent` or `pixel`) Sets the type of threshold that would trigger a failure.
113
113
  * `updatePassedSnapshot`: (default `false`) Updates a snapshot even if it passed the threshold against the existing one.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-image-snapshot",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Jest matcher for image comparisons. Most commonly used for visual regression testing.",
5
5
  "main": "src/index.js",
6
6
  "engines": {
package/src/index.js CHANGED
@@ -128,7 +128,7 @@ function configureToMatchImageSnapshot({
128
128
  customSnapshotsDir: commonCustomSnapshotsDir,
129
129
  customDiffDir: commonCustomDiffDir,
130
130
  diffDirection: commonDiffDirection = 'horizontal',
131
- noColors: commonNoColors = false,
131
+ noColors: commonNoColors,
132
132
  failureThreshold: commonFailureThreshold = 0,
133
133
  failureThresholdType: commonFailureThresholdType = 'pixel',
134
134
  updatePassedSnapshot: commonUpdatePassedSnapshot = false,
@@ -155,7 +155,11 @@ function configureToMatchImageSnapshot({
155
155
  const {
156
156
  testPath, currentTestName, isNot, snapshotState,
157
157
  } = this;
158
- const chalk = new Chalk({ enabled: !noColors });
158
+ const chalkOptions = {};
159
+ if (typeof noColors !== 'undefined') {
160
+ chalkOptions.enabled = !noColors;
161
+ }
162
+ const chalk = new Chalk(chalkOptions);
159
163
 
160
164
  const retryTimes = parseInt(global[Symbol.for('RETRY_TIMES')], 10) || 0;
161
165