Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

happo-e2e

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

happo-e2e - npm Package Compare versions

Comparing version 2.2.4 to 2.2.5

77

controller.js

@@ -108,33 +108,29 @@ const crypto = require('crypto');

async finish() {
async uploadAssetsIfNeeded({ buffer, hash }) {
if (HAPPO_DEBUG) {
console.log('[HAPPO] Running Controller.finish');
console.log(`[HAPPO] Checking if we need to upload assets`);
}
if (this.localSnapshots.length) {
try {
// Check if the assets already exist. If so, we don't have to upload them.
const assetsDataRes = await makeRequest(
{
url: `${this.happoConfig.endpoint}/api/snap-requests/assets-data/${hash}`,
method: 'GET',
json: true,
},
{ ...this.happoConfig },
);
if (HAPPO_DEBUG) {
console.log(
`[HAPPO] Processing ${this.localSnapshots.length} local snapshots`,
`[HAPPO] Reusing existing assets at ${assetsDataRes.path} (previously uploaded on ${assetsDataRes.uploadedAt})`,
);
}
await this.processSnapRequestIds([await this.uploadLocalSnapshots()]);
return null;
}
if (!this.snapshots.length) {
if (HAPPO_DEBUG) {
console.log('[HAPPO] No snapshots recorded');
return assetsDataRes.path;
} catch (e) {
if (e.statusCode !== 404) {
throw e;
}
return null;
}
this.dedupeSnapshots();
await downloadCSSContent(this.allCssBlocks);
const allUrls = [...this.snapshotAssetUrls];
this.allCssBlocks.forEach(block => {
findCSSAssetUrls(block.content).forEach(url =>
allUrls.push({ url, baseUrl: block.assetsBaseUrl || block.baseUrl }),
);
});
const uniqueUrls = getUniqueUrls(allUrls);
const { buffer, hash } = await createAssetPackage(uniqueUrls);
if (HAPPO_DEBUG) {

@@ -163,3 +159,38 @@ console.log(`[HAPPO] Uploading assets package`);

}
return assetsRes.path;
}
async finish() {
if (HAPPO_DEBUG) {
console.log('[HAPPO] Running Controller.finish');
}
if (this.localSnapshots.length) {
if (HAPPO_DEBUG) {
console.log(
`[HAPPO] Processing ${this.localSnapshots.length} local snapshots`,
);
}
await this.processSnapRequestIds([await this.uploadLocalSnapshots()]);
return null;
}
if (!this.snapshots.length) {
if (HAPPO_DEBUG) {
console.log('[HAPPO] No snapshots recorded');
}
return null;
}
this.dedupeSnapshots();
await downloadCSSContent(this.allCssBlocks);
const allUrls = [...this.snapshotAssetUrls];
this.allCssBlocks.forEach(block => {
findCSSAssetUrls(block.content).forEach(url =>
allUrls.push({ url, baseUrl: block.assetsBaseUrl || block.baseUrl }),
);
});
const uniqueUrls = getUniqueUrls(allUrls);
const { buffer, hash } = await createAssetPackage(uniqueUrls);
const assetsPath = await this.uploadAssetsIfNeeded({ buffer, hash });
const globalCSS = this.allCssBlocks.map(block => ({

@@ -210,3 +241,3 @@ id: block.key,

globalCSS,
assetsPackage: assetsRes.path,
assetsPackage: assetsPath,
snapPayloads: snapshotsForTarget,

@@ -213,0 +244,0 @@ apiKey: this.happoConfig.apiKey,

{
"name": "happo-e2e",
"version": "2.2.4",
"version": "2.2.5",
"description": "Helpers for e2e integrations with Happo",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc