testcafe-blink-diff
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -176,3 +176,3 @@ const wargs = require('wargs'); | ||
diff.run((error, result) => { | ||
process.stdout.write(` ${groupedName} (${error ? 'FAILED' : 'OK'})\n`); | ||
process.stdout.write(` ${groupedName} ${error ? 'FAILED' : 'DONE'}\n`); | ||
@@ -184,3 +184,3 @@ if (error) { | ||
const fixed = ((result.differences / result.dimension) * 100).toFixed(2); | ||
const errorMessage = `Failed '${groupedName}', diff: ${fixed}%`; | ||
const errorMessage = `Failed with ${fixed}% of differences`; | ||
@@ -229,3 +229,3 @@ if (!ok && !argv.flags.force) { | ||
.replace('/* json */', JSON.stringify(reportInfo)) | ||
.replace('/* code */', `!function() { ${readFile('dist/reporter.iife.js')} }()`); | ||
.replace('/* code */', readFile('dist/reporter.iife.min.js')); | ||
} | ||
@@ -232,0 +232,0 @@ |
@@ -15,2 +15,6 @@ const path = require('path'); | ||
function debug(message) { | ||
console.warn(`[testcafe-blink-diff] ${message}`); | ||
} | ||
function normalize(value) { | ||
@@ -47,9 +51,25 @@ return value | ||
const selectors = Array.isArray(options.blockOut) ? options.blockOut : [options.blockOut]; | ||
const results = await Promise.all(selectors.map(x => { | ||
const results = []; | ||
await Promise.all(selectors.map(async x => { | ||
if (typeof x !== 'function') { | ||
console.warn(`[testcafe-blink-diff] Expecting a Selector() instance, given '${x}'`); | ||
debug(`Expecting a Selector() instance, given '${x}'`); | ||
return; | ||
} | ||
return x().then(result => result && result.boundingClientRect); | ||
let result; | ||
try { | ||
result = await x.with({ boundTestRun: t }); | ||
} catch (e) { | ||
// do nothing | ||
} finally { | ||
if (!result) { | ||
const key = Object.getOwnPropertySymbols(x)[0]; | ||
debug(`Selector('${x[key].fn}') was not found on the DOM`); | ||
} | ||
results.push(result.boundingClientRect); | ||
} | ||
})); | ||
@@ -56,0 +76,0 @@ |
{ | ||
"name": "testcafe-blink-diff", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Visual regression for Testcafé through BlinkDiff", | ||
@@ -14,7 +14,7 @@ "main": "lib/index.js", | ||
"lib/builder.js", | ||
"dist/reporter.iife.js" | ||
"dist/reporter.iife.min.js" | ||
], | ||
"scripts": { | ||
"dist": "mkdir -p dist && npm run build", | ||
"build": "bili --format iife --js buble --name reporter" | ||
"build": "bili --target node --format iife-min --js buble --name reporter" | ||
}, | ||
@@ -21,0 +21,0 @@ "author": "Alvaro Cabrera <pateketrueke@gmail.com>", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
21468
304
1