Comparing version 3.3.2 to 3.3.3
@@ -21,4 +21,2 @@ const crypto = require('crypto'); | ||
const { HAPPO_E2E_PORT, HAPPO_DEBUG, HAPPO_ENABLED } = process.env; | ||
function getUniqueUrls(urls) { | ||
@@ -42,2 +40,4 @@ const seenKeys = new Set(); | ||
async function downloadCSSContent(blocks) { | ||
const { HAPPO_DEBUG } = process.env; | ||
const actions = blocks.map((block) => async () => { | ||
@@ -88,3 +88,10 @@ if (block.href) { | ||
this.knownComponentVariants = {}; | ||
this.happoDebug = false; | ||
const { HAPPO_E2E_PORT, HAPPO_ENABLED, HAPPO_DEBUG } = process.env; | ||
if (HAPPO_DEBUG) { | ||
this.happoDebug = true; | ||
} | ||
if (!(HAPPO_E2E_PORT || HAPPO_ENABLED)) { | ||
@@ -104,3 +111,3 @@ console.log( | ||
} | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log('[HAPPO] Running Controller.init'); | ||
@@ -113,3 +120,3 @@ } | ||
const result = !!this.happoConfig; | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log('[HAPPO] Controller.isActive()?', result); | ||
@@ -121,3 +128,3 @@ } | ||
async uploadAssetsIfNeeded({ buffer, hash }) { | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log(`[HAPPO] Checking if we need to upload assets`); | ||
@@ -136,3 +143,3 @@ } | ||
); | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log( | ||
@@ -149,3 +156,3 @@ `[HAPPO] Reusing existing assets at ${assetsDataRes.path} (previously uploaded on ${assetsDataRes.uploadedAt})`, | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log(`[HAPPO] Uploading assets package`); | ||
@@ -170,3 +177,3 @@ } | ||
); | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log('[HAPPO] Done uploading assets package, got', assetsRes); | ||
@@ -178,7 +185,7 @@ } | ||
async finish() { | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log('[HAPPO] Running Controller.finish'); | ||
} | ||
if (this.localSnapshots.length) { | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log( | ||
@@ -192,3 +199,3 @@ `[HAPPO] Processing ${this.localSnapshots.length} local snapshots`, | ||
if (!this.snapshots.length) { | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log('[HAPPO] No snapshots recorded'); | ||
@@ -220,3 +227,3 @@ } | ||
for (const block of globalCSS) { | ||
block.css = block.css.split(url.url).join(url.name); | ||
block.css = block.css?.split(url.url).join(url.name); | ||
} | ||
@@ -236,3 +243,3 @@ this.snapshots.forEach((snapshot) => { | ||
for (const name of Object.keys(this.happoConfig.targets)) { | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log(`[HAPPO] Sending snap-request(s) for target=${name}`); | ||
@@ -244,3 +251,3 @@ } | ||
if (!snapshotsForTarget.length) { | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log(`[HAPPO] No snapshots recorded for target=${name}. Skipping.`); | ||
@@ -261,3 +268,3 @@ } | ||
}); | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log( | ||
@@ -292,3 +299,3 @@ `[HAPPO] Snap-request(s) for target=${name} created with ID(s)=${requestIds.join( | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log(`[HAPPO] Registering snapshot for ${component} > ${variant}`); | ||
@@ -348,3 +355,3 @@ } | ||
removeSnapshotsMadeBetween({ start, end }) { | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log( | ||
@@ -365,3 +372,3 @@ `[HAPPO] Removing snapshots made between ${new Date( | ||
removeDuplicatesInTimeframe({ start, end }) { | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log( | ||
@@ -384,3 +391,3 @@ `[HAPPO] Removing duplicate snapshots made between ${new Date( | ||
// Found a duplicate made in the timeframe specified | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log( | ||
@@ -401,2 +408,4 @@ `[HAPPO] Found duplicate snapshot to remove: "${component}", "${variant}" at timestamp ${new Date( | ||
async processSnapRequestIds(allRequestIds) { | ||
const { HAPPO_E2E_PORT } = process.env; | ||
if (HAPPO_E2E_PORT) { | ||
@@ -472,3 +481,3 @@ // We're running with `happo-cypress --` | ||
const pathToFile = Buffer.isBuffer(pathOrBuffer) ? undefined : pathOrBuffer; | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log(`[HAPPO] Uploading image ${pathToFile || ''}`); | ||
@@ -492,3 +501,3 @@ } | ||
// image has already been uploaded | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log( | ||
@@ -518,3 +527,3 @@ `[HAPPO] Image has already been uploaded: ${uploadUrlResult.url}`, | ||
); | ||
if (HAPPO_DEBUG) { | ||
if (this.happoDebug) { | ||
console.log(`[HAPPO] Uploaded image: ${uploadUrlResult.url}`); | ||
@@ -521,0 +530,0 @@ } |
{ | ||
"name": "happo-e2e", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Helpers for e2e integrations with Happo", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,4 +10,2 @@ const { Writable } = require('stream'); | ||
const { HAPPO_DOWNLOAD_ALL, HAPPO_DEBUG } = process.env; | ||
const FILE_CREATION_DATE = new Date('Fri March 20 2020 13:44:55 GMT+0100 (CET)'); | ||
@@ -45,2 +43,4 @@ | ||
module.exports = function createAssetPackage(urls) { | ||
const { HAPPO_DOWNLOAD_ALL, HAPPO_DEBUG } = process.env; | ||
if (HAPPO_DEBUG) { | ||
@@ -47,0 +47,0 @@ console.log(`[HAPPO] Creating asset package from urls`, urls); |
{ | ||
"status": "passed", | ||
"failedTests": [] | ||
"status": "failed", | ||
"failedTests": [ | ||
"8fe3f87dad6a5cfdb979-b564804f39834751e12e" | ||
] | ||
} |
109334
3277
13