@percy/core
Advanced tools
Comparing version 1.30.8 to 1.30.9-beta.0
@@ -494,2 +494,3 @@ import { request as makeRequest } from '@percy/client/utils'; | ||
async function saveResponseResource(network, request, session) { | ||
var _response$headers; | ||
let { | ||
@@ -511,3 +512,4 @@ disableCache, | ||
// If content-length is more than our allowed 25MB, no need to process that resouce we can return log. | ||
let contentLength = parseInt(response.headers['Content-Length']); | ||
let contentLength = (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers[Object.keys(response.headers).find(key => key.toLowerCase() === 'content-length')]; | ||
contentLength = parseInt(contentLength); | ||
if (contentLength > MAX_RESOURCE_SIZE) { | ||
@@ -532,2 +534,5 @@ return log.debug('- Skipping resource larger than 25MB', meta); | ||
return log.debug('- Skipping empty response', meta); | ||
} else if (body.length > MAX_RESOURCE_SIZE) { | ||
log.debug('- Missing headers for the requested resource.', meta); | ||
return log.debug('- Skipping resource larger than 25MB', meta); | ||
} else if (!ALLOWED_STATUSES.includes(response.status)) { | ||
@@ -534,0 +539,0 @@ return log.debug(`- Skipping disallowed status [${response.status}]`, meta); |
@@ -118,2 +118,9 @@ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); } | ||
} | ||
logQueueSize() { | ||
this.log.debug(`${this.name} queueInfo: ${JSON.stringify({ | ||
queued: _classPrivateFieldGet(_queued, this).size, | ||
pending: _classPrivateFieldGet(_pending, this).size, | ||
total: _classPrivateFieldGet(_pending, this).size + _classPrivateFieldGet(_queued, this).size | ||
})}`); | ||
} | ||
// Cancels and aborts a specific item task. | ||
@@ -247,2 +254,3 @@ cancel(item) { | ||
function _dequeue() { | ||
this.logQueueSize(); | ||
if (!_classPrivateFieldGet(_queued, this).size || this.readyState < 2) return; | ||
@@ -249,0 +257,0 @@ if (_classPrivateFieldGet(_pending, this).size >= this.concurrency) return; |
@@ -6,3 +6,3 @@ import logger from '@percy/logger'; | ||
import Queue from './queue.js'; | ||
import { request, hostnameMatches, yieldTo, snapshotLogName, decodeAndEncodeURLWithLogging, compareObjectTypes } from './utils.js'; | ||
import { request, hostnameMatches, yieldTo, snapshotLogName, decodeAndEncodeURLWithLogging, compareObjectTypes, normalizeOptions } from './utils.js'; | ||
import { JobData } from './wait-for-job.js'; | ||
@@ -196,5 +196,5 @@ | ||
let log = logger('core:snapshot'); | ||
// decide which schema to validate against | ||
let schema = ['domSnapshot', 'dom-snapshot', 'dom_snapshot'].some(k => k in options) && '/snapshot/dom' || 'url' in options && '/snapshot' || 'sitemap' in options && '/snapshot/sitemap' || 'serve' in options && '/snapshot/server' || 'snapshots' in options && '/snapshot/list' || '/snapshot'; | ||
options = normalizeOptions(options); | ||
let { | ||
@@ -231,3 +231,2 @@ // normalize, migrate, and remove certain properties from validating | ||
} | ||
// warn on validation errors | ||
@@ -234,0 +233,0 @@ let errors = PercyConfig.validate(migrated, schema); |
@@ -543,2 +543,29 @@ import EventEmitter from 'events'; | ||
return true; | ||
} | ||
const OPTION_MAPPINGS = { | ||
name: 'name', | ||
widths: 'widths', | ||
scope: 'scope', | ||
scopeoptions: 'scopeOptions', | ||
minheight: 'minHeight', | ||
enablejavascript: 'enableJavaScript', | ||
enablelayout: 'enableLayout', | ||
clientinfo: 'clientInfo', | ||
environmentinfo: 'environmentInfo', | ||
sync: 'sync', | ||
testcase: 'testCase', | ||
labels: 'labels', | ||
thtestcaseexecutionid: 'thTestCaseExecutionId', | ||
resources: 'resources', | ||
meta: 'meta', | ||
snapshot: 'snapshot' | ||
}; | ||
export function normalizeOptions(options) { | ||
const normalizedOptions = {}; | ||
for (const key in options) { | ||
const lowerCaseKey = key.toLowerCase().replace(/[-_]/g, ''); | ||
const normalizedKey = OPTION_MAPPINGS[lowerCaseKey] ? OPTION_MAPPINGS[lowerCaseKey] : key; | ||
normalizedOptions[normalizedKey] = options[key]; | ||
} | ||
return normalizedOptions; | ||
} |
{ | ||
"name": "@percy/core", | ||
"version": "1.30.8", | ||
"version": "1.30.9-beta.0", | ||
"license": "MIT", | ||
@@ -12,3 +12,3 @@ "repository": { | ||
"access": "public", | ||
"tag": "latest" | ||
"tag": "beta" | ||
}, | ||
@@ -47,8 +47,8 @@ "engines": { | ||
"dependencies": { | ||
"@percy/client": "1.30.8", | ||
"@percy/config": "1.30.8", | ||
"@percy/dom": "1.30.8", | ||
"@percy/logger": "1.30.8", | ||
"@percy/monitoring": "1.30.8", | ||
"@percy/webdriver-utils": "1.30.8", | ||
"@percy/client": "1.30.9-beta.0", | ||
"@percy/config": "1.30.9-beta.0", | ||
"@percy/dom": "1.30.9-beta.0", | ||
"@percy/logger": "1.30.9-beta.0", | ||
"@percy/monitoring": "1.30.9-beta.0", | ||
"@percy/webdriver-utils": "1.30.9-beta.0", | ||
"content-disposition": "^0.5.4", | ||
@@ -66,3 +66,3 @@ "cross-spawn": "^7.0.3", | ||
}, | ||
"gitHead": "daa3c96d70488a49671e48427c9b363c68876935" | ||
"gitHead": "5068eefe44f4ea22427d80e538b76603fc2f5f6b" | ||
} |
// aliased to src during tests | ||
import Server from '../../dist/server.js'; | ||
export function createTestServer({ default: defaultReply, ...replies }, port = 8000) { | ||
export function createTestServer({ default: defaultReply, ...replies }, port = 8000, options = {}) { | ||
let server = new Server(); | ||
// alternate route handling | ||
let handleReply = reply => async (req, res) => { | ||
let handleReply = (reply, options = {}) => async (req, res) => { | ||
let [status, headers, body] = typeof reply === 'function' ? await reply(req) : reply; | ||
if (!Buffer.isBuffer(body) && typeof body !== 'string') body = JSON.stringify(body); | ||
if (options.noHeaders) { | ||
return res.writeHead(status).end(body); | ||
} | ||
if (options.headersOverride) { | ||
headers = { ...headers, ...options.headersOverride }; | ||
} | ||
return res.send(status, headers, body); | ||
@@ -15,3 +22,3 @@ }; | ||
// map replies to alternate route handlers | ||
server.reply = (p, reply) => (replies[p] = handleReply(reply), null); | ||
server.reply = (p, reply, options = {}) => (replies[p] = handleReply(reply, options), null); | ||
for (let [p, reply] of Object.entries(replies)) server.reply(p, reply); | ||
@@ -18,0 +25,0 @@ if (defaultReply) defaultReply = handleReply(defaultReply); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
422852
5787
2
+ Added@percy/client@1.30.9-beta.0(transitive)
+ Added@percy/config@1.30.9-beta.0(transitive)
+ Added@percy/dom@1.30.9-beta.0(transitive)
+ Added@percy/env@1.30.9-beta.0(transitive)
+ Added@percy/logger@1.30.9-beta.0(transitive)
+ Added@percy/monitoring@1.30.9-beta.0(transitive)
+ Added@percy/sdk-utils@1.30.9-beta.0(transitive)
+ Added@percy/webdriver-utils@1.30.9-beta.0(transitive)
- Removed@percy/client@1.30.8(transitive)
- Removed@percy/config@1.30.8(transitive)
- Removed@percy/dom@1.30.8(transitive)
- Removed@percy/env@1.30.8(transitive)
- Removed@percy/logger@1.30.8(transitive)
- Removed@percy/monitoring@1.30.8(transitive)
- Removed@percy/sdk-utils@1.30.8(transitive)
- Removed@percy/webdriver-utils@1.30.8(transitive)
Updated@percy/client@1.30.9-beta.0
Updated@percy/config@1.30.9-beta.0
Updated@percy/dom@1.30.9-beta.0
Updated@percy/logger@1.30.9-beta.0