chai-baseline
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -33,4 +33,6 @@ /// <reference types="node" /> | ||
reference?: string; | ||
/** Whether to show file contents (rather than file names) when a reference or local baseline is missing. */ | ||
showFileContentsWhenMissing?: boolean; | ||
} | ||
export declare function chaiBaseline(chai: Chai.ChaiStatic, utils: Chai.UtilsStatic): void; | ||
export default chaiBaseline; |
@@ -13,17 +13,2 @@ "use strict"; | ||
exports.chaiBaseline = void 0; | ||
/*! | ||
* Copyright 2016 Ron Buckton | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const fs = require("fs"); | ||
@@ -61,2 +46,10 @@ const path = require("path"); | ||
utils.flag(this, "object", local); | ||
if (!options.showFileContentsWhenMissing) { | ||
if (local === undefined && reference !== undefined) { | ||
this.assert(false, `Reference baseline exists for '${file}', but no local output was generated.`, `Reference baseline exists for '${file}', but local output was generated.`, localFile, "<no file>", false); | ||
} | ||
if (reference === undefined && local !== undefined) { | ||
this.assert(false, `Local output was generated, but no reference baseline exists for '${file}'.`, `Local output was generated, but reference baseline exists for '${file}'.`, "<no file>", localFile, false); | ||
} | ||
} | ||
try { | ||
@@ -66,4 +59,4 @@ this.equals(reference); | ||
catch (e) { | ||
e.expected = reference || ""; | ||
e.actual = local || ""; | ||
e.expected = reference; | ||
e.actual = local; | ||
e.showDiff = true; | ||
@@ -70,0 +63,0 @@ throw e; |
{ | ||
"name": "chai-baseline", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "File-based baseline testing for chai", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33200
383