Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli-build/test/approve.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('percy build:approve', () => {
]);
});

it('doesnot require percy token', async () => {
it('does not require percy token', async () => {
process.env.PERCY_FORCE_PKG_VALUE = JSON.stringify({ name: '@percy/client', version: '1.0.0' });
process.env.BROWSERSTACK_USERNAME = 'env-username';
process.env.BROWSERSTACK_ACCESS_KEY = 'env-access-key';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-config/test/validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('percy config:validate', () => {
]);
});

it('errors with invalid or unkown config options', async () => {
it('errors with invalid or unknown config options', async () => {
fs.writeFileSync('.invalid.yml', 'version: 2\ntest:\n value: false\nbar: baz');
await expectAsync(validate(['.invalid.yml'])).toBeRejected();

Expand Down
2 changes: 1 addition & 1 deletion packages/cli-exec/src/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const exec = command('exec', {
});

// Spawn a command with cross-spawn and return an array containing the resulting status code along
// with any error encountered while running. Uses a generator pattern to handle interupt signals.
// with any error encountered while running. Uses a generator pattern to handle interrupt signals.
async function* spawn(cmd, args, percy) {
let { default: crossSpawn } = await import('cross-spawn');
let proc, closed, error;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-upload/test/upload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('percy upload', () => {
it('stops uploads on process termination', async () => {
await api.mock({ delay: 100 });

// specify a low concurrency to interupt the queue later
// specify a low concurrency to interrupt the queue later
fs.writeFileSync('.percy.yml', [
'version: 2',
'upload:',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ request](https://www.browserstack.com/contact?ref=percy#technical-support).

## Developing

This project is built with [lerna](https://lerna.js.org/). The core libaries and CLI plugins are
This project is built with [lerna](https://lerna.js.org/). The core libraries and CLI plugins are
located in [./packages](./packages). Run `yarn` to install dependencies after cloning the repo and
use the following scripts for various development tasks:

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function getSiblings(root) {
const siblings = [path.join(root, '..')];

// Check if Percy CLI is installed using '.pnpm' by searching
// ffor the .pnpm folder in the root path
// for the .pnpm folder in the root path
const nodeModulesIndex = root.indexOf('.pnpm');
if (nodeModulesIndex !== -1) {
// add the parent directory of the .pnpm and append /@percy
Expand All @@ -114,7 +114,7 @@ export function getSiblings(root) {
return siblings;
}

// Imports and returns compatibile CLI commands from various sources
// Imports and returns compatible CLI commands from various sources
export async function importCommands() {
let root = path.resolve(url.fileURLToPath(import.meta.url), '../..');

Expand Down
4 changes: 2 additions & 2 deletions packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ await client.sendSnapshot(buildId, snapshotOptions)

- `name` — Snapshot name
- `widths` — Widths to take screenshots at
- `minHeight` — Miniumum screenshot height
- `minHeight` — Minimum screenshot height
- `enableJavaScript` — Enable JavaScript for screenshots
- `clientInfo` — Additional client info
- `environmentInfo` — Additional environment info
Expand Down Expand Up @@ -164,4 +164,4 @@ await client.waitForBuild({
- `commit` — Commit SHA (**required** when missing `build`)
- `project` — Project slug (**required** when using `commit`)
- `timeout` — Timeout in milliseconds to wait with no updates (**default** `10 * 60 * 1000`)
- `interval` — Interval in miliseconds to check for updates (**default** `10000`)
- `interval` — Interval in milliseconds to check for updates (**default** `10000`)
6 changes: 3 additions & 3 deletions packages/client/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class PercyClient {

// Creates a build with optional build resources. Only one build can be
// created at a time per instance so snapshots and build finalization can be
// done more seemlessly without manually tracking build ids
// done more seamlessly without manually tracking build ids
async createBuild({ resources = [], projectType, cliStartTime = null } = {}) {
this.log.debug('Creating a new build...');
let source = 'user_created';
Expand Down Expand Up @@ -529,7 +529,7 @@ export class PercyClient {
} = {}) {
validateId('snapshot', snapshotId);
// Remove post percy api deploy
this.log.debug(`Creating comparision: ${tag.name}...`, meta);
this.log.debug(`Creating comparison: ${tag.name}...`, meta);

for (let tile of tiles) {
if (tile.sha) continue;
Expand All @@ -541,7 +541,7 @@ export class PercyClient {
}
}
let regionsArr = makeRegions(regions, algorithm, algorithmConfiguration);
this.log.debug(`${tiles.length} tiles for comparision: ${tag.name}...`, meta);
this.log.debug(`${tiles.length} tiles for comparison: ${tag.name}...`, meta);

return this.post(`snapshots/${snapshotId}/comparisons`, {
data: {
Expand Down
4 changes: 2 additions & 2 deletions packages/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ configuration files.

## Loading config files

The `.load()` method will load and validate a configuation file, optionally merging it with any
The `.load()` method will load and validate a configuration file, optionally merging it with any
provided `overrides`. If no `path` is provided, will search for the first supported config found
from the current directory up to the home directoy. Configuration files are cached and reused unless
from the current directory up to the home directory. Configuration files are cached and reused unless
`reload` is `true`.

```js
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export function validate(data, key = '/config') {
if (!algorithmType) {
errors.set(pathStr, {
path: pathStr,
message: 'algorithmConfiguration needs algorigthm to be passed'
message: 'algorithmConfiguration needs algorithm to be passed'
});
}

Expand Down
6 changes: 3 additions & 3 deletions packages/config/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,12 +806,12 @@ describe('PercyConfig', () => {
})).toEqual([
{
path: 'algorithmConfiguration',
message: 'algorithmConfiguration needs algorigthm to be passed'
message: 'algorithmConfiguration needs algorithm to be passed'
}
]);
});

it('validates algorithmConfiguration when layout algorigthm is passed', () => {
it('validates algorithmConfiguration when layout algorithm is passed', () => {
expect(PercyConfig.validate({
algorithm: 'layout',
algorithmConfiguration: { diffSensitivity: 2 }
Expand All @@ -823,7 +823,7 @@ describe('PercyConfig', () => {
]);
});

it('validates algorithmConfiguration when standard algorigthm is passed', () => {
it('validates algorithmConfiguration when standard algorithm is passed', () => {
expect(PercyConfig.validate({
algorithm: 'standard',
algorithmConfiguration: { diffSensitivity: 2 }
Expand Down
6 changes: 3 additions & 3 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ The following options can also be defined within a Percy config file
- `userAgent` — Custom user-agent string used when requesting assets
- `cookies` — Browser cookies to use when requesting assets
- `networkIdleTimeout` — Milliseconds to wait for the network to idle (**default** `100`)
- `concurrency` — Asset discovery concerrency (**default** `5`)
- `concurrency` — Asset discovery concurrency (**default** `5`)
- `launchOptions` — Asset discovery browser launch options
- `executable` — Browser executable path (**default** `process.env.PERCY_BROWSER_EXECUTABLE`)
- `timeout` — Discovery launch timeout, in milliseconds (**default** `30000`)
- `args` — Additional browser process arguments
- `headless` — Runs the browser headlessy (**default** `true`)
- `headless` — Runs the browser headlessly (**default** `true`)

Additional Percy config file options are also allowed and will override any options defined by a
local config file. These config file options are also made available to SDKs via the local API
Expand Down Expand Up @@ -282,7 +282,7 @@ environment variable.

- Vist https://chromiumdash.appspot.com/releases?platform=Mac and check for current version in use.
- Get Branch Base Position for that release.
- Visit https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/ and search for exact/neareast Branch Base Position.
- Visit https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/ and search for exact/nearest Branch Base Position.

### Excerpt

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function createPercyServer(percy, port) {
res.setHeader('X-Percy-Core-Version', percy.testing?.version ?? pkg.version);
}

// track all api reqeusts in testing mode
// track all api requests in testing mode
if (percy.testing && !req.url.pathname.startsWith('/test/')) {
(percy.testing.requests ||= []).push({
url: `${req.url.pathname}${req.url.search}`,
Expand Down Expand Up @@ -115,7 +115,7 @@ export function createPercyServer(percy, port) {

let content = await fs.promises.readFile(PERCY_DOM, 'utf-8');
let wrapper = '(window.PercyAgent = class { snapshot(n, o) { return PercyDOM.serialize(o); } });';
return res.send(200, 'applicaton/javascript', content.concat(wrapper));
return res.send(200, 'application/javascript', content.concat(wrapper));
})
// post one or more snapshots, optionally async
.route('post', '/percy/snapshot', async (req, res) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
let cookies = snapshot.domSnapshot?.cookies || snapshot.domSnapshot?.[0]?.cookies;
cookies = parseCookies(cookies);

// iterate over device to trigger reqeusts and capture other dpr width
// iterate over device to trigger requests and capture other dpr width
async function* captureResponsiveAssets() {
for (const device of captureForDevices) {
discovery = { ...discovery, captureResponsiveAssetsEnabled: true };
Expand Down Expand Up @@ -317,7 +317,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
let { widths, execute } = snap;
let [width] = widths;

// iterate over widths to trigger reqeusts and capture other widths
// iterate over widths to trigger requests and capture other widths
if (isBaseSnapshot || captureWidths) {
for (let i = 0; i < widths.length - 1; i++) {
if (captureWidths) yield* takeSnapshot(snap, width);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import logger from '@percy/logger';
import cp from 'child_process';
import { ProxyHttpsAgent, formatBytes } from '@percy/client/utils';

// Formats milleseconds as "MM:SS"
// Formats milliseconds as "MM:SS"
function formatTime(ms) {
let minutes = (ms / 1000 / 60).toString().split('.')[0].padStart(2, '0');
let seconds = (ms / 1000 % 60).toFixed().padStart(2, '0');
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ export class Network {
_handleResponseReceived = async (session, event) => {
let { requestId, response } = event;
// await on requestWillBeSent
// no explicitly wait on requestWillBePaused as we implictly wait on it, since it manipulates the lifeCycle of request using Fetch module
// no explicitly wait on requestWillBePaused as we implicitly wait on it, since it manipulates the lifeCycle of request using Fetch module
await this.#requestsLifeCycleHandler.get(requestId).requestWillBeSent;
let request = this.#requests.get(requestId);
/* istanbul ignore if: race condition paranioa */
/* istanbul ignore if: race condition paranoia */
if (!request) return;

request.response = response;
Expand All @@ -293,7 +293,7 @@ export class Network {
// wait for request to be sent
await this.#requestsLifeCycleHandler.get(requestId).requestWillBeSent;
let request = this.#requests.get(requestId);
/* istanbul ignore else: race condition paranioa */
/* istanbul ignore else: race condition paranoia */
if (request) this._forgetRequest(request);
}

Expand All @@ -304,7 +304,7 @@ export class Network {
// wait for upto 2 seconds or check if response has been sent
await this.#requestsLifeCycleHandler.get(requestId).responseReceived;
let request = this.#requests.get(requestId);
/* istanbul ignore if: race condition paranioa */
/* istanbul ignore if: race condition paranoia */
if (!request) return;

await saveResponseResource(this, request, session);
Expand All @@ -320,7 +320,7 @@ export class Network {
// and in any case, order of processing for responseReceived and loadingFailed does not matter, as response capturing is done in loadingFinished
await this.#requestsLifeCycleHandler.get(requestId).requestWillBeSent;
let request = this.#requests.get(event.requestId);
/* istanbul ignore if: race condition paranioa */
/* istanbul ignore if: race condition paranoia */
if (!request) return;

// If request was aborted, keep track of it as we need to cancel any in process callbacks for
Expand Down Expand Up @@ -455,7 +455,7 @@ async function makeDirectRequest(network, request, session) {
return makeRequest(request.url, { buffer: true, headers });
}

// Save a resource from a request, skipping it if specific paramters are not met
// Save a resource from a request, skipping it if specific parameters are not met
async function saveResponseResource(network, request, session) {
let { disableCache, allowedHostnames, enableJavaScript } = network.intercept;

Expand All @@ -467,7 +467,7 @@ async function saveResponseResource(network, request, session) {
url,
responseStatus: response?.status
};
// Checing for content length more than 100MB, to prevent websocket error which is governed by
// Checking for content length more than 100MB, to prevent websocket error which is governed by
// maxPayload option of websocket defaulted to 100MB.
// If content-length is more than our allowed 25MB, no need to process that resouce we can return log.
let contentLength = response.headers?.[Object.keys(response.headers).find(key => key.toLowerCase() === 'content-length')];
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/percy.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class Percy {
if (process.env.PERCY_CLIENT_ERROR_LOGS !== 'false') {
this.log.warn('Notice: Percy collects CI logs to improve service and enhance your experience. These logs help us debug issues and provide insights on your dashboards, making it easier to optimize the product experience. Logs are stored securely for 30 days. You can opt out anytime with export PERCY_CLIENT_ERROR_LOGS=false, but keeping this enabled helps us offer the best support and features.');
}
// Not awaiting proxy check as this can be asyncronous when not enabled
// Not awaiting proxy check as this can be asynchronous when not enabled
const detectProxy = detectSystemProxyAndLog(this.config.percy.useSystemProxy);
if (this.config.percy.useSystemProxy) await detectProxy;
// start the snapshots queue immediately when not delayed or deferred
Expand Down Expand Up @@ -380,7 +380,7 @@ export class Percy {
if (cpuInfo.currentUsagePercent >= 80 || memoryUsageInfo.currentUsagePercent >= 80) {
let currentConcurrent = this.#discovery.concurrency;

// concurrency must be betweeen [1, (default/user defined value)]
// concurrency must be between [1, (default/user defined value)]
let newConcurrency = Math.max(1, parseInt(currentConcurrent / 2));
newConcurrency = Math.min(this.discoveryMaxConcurrency, newConcurrency);

Expand All @@ -390,7 +390,7 @@ export class Percy {
let currentConcurrent = this.#discovery.concurrency;
let newConcurrency = currentConcurrent + 2;

// concurrency must be betweeen [1, (default/user-defined value)]
// concurrency must be between [1, (default/user-defined value)]
newConcurrency = Math.min(this.discoveryMaxConcurrency, newConcurrency);
newConcurrency = Math.max(1, newConcurrency);

Expand Down Expand Up @@ -432,7 +432,7 @@ export class Percy {
throw new Error('Cannot capture DOM snapshots when asset discovery is disabled');
}

// return an async generator to allow cancelation
// return an async generator to allow cancellation
return (async function*() {
let server;

Expand Down Expand Up @@ -520,7 +520,7 @@ export class Percy {
Object.assign(options, { ...callback });
}

// return an async generator to allow cancelation
// return an async generator to allow cancellation
return (async function*() {
try {
return yield* yieldTo(this.#snapshots.push(options));
Expand Down Expand Up @@ -636,7 +636,7 @@ export class Percy {
// This can be due to proxy issue
this.log.error('percy.io might not be reachable, check network connection, proxy and ensure that percy.io is whitelisted.');
if (!this.#proxyEnabled()) {
this.log.error('If inside a proxied envirnment, please configure the following environment variables: HTTP_PROXY, [ and optionally HTTPS_PROXY if you need it ]. Refer to our documentation for more details');
this.log.error('If inside a proxied environment, please configure the following environment variables: HTTP_PROXY, [ and optionally HTTPS_PROXY if you need it ]. Refer to our documentation for more details');
}
}
this.log.error('Unable to analyze error logs');
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class Queue {
return task;
}

// returns a generator that yeilds until started and no longer pending, calling the
// returns a generator that yields until started and no longer pending, calling the
// callback every 10ms during checks with the current number of pending tasks
idle(callback) {
return yieldFor(() => {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function validURL(url, base) {

function validateAndFixSnapshotUrl(snapshot) {
let log = logger('core:snapshot');
// encoding snapshot url, if contians invalid URI characters/syntax
// encoding snapshot url, if contains invalid URI characters/syntax
let modifiedURL = decodeAndEncodeURLWithLogging(snapshot.url, log, {
meta: { snapshot: { name: snapshot.name || snapshot.url } },
shouldLogWarning: true,
Expand Down Expand Up @@ -95,7 +95,7 @@ function mapSnapshotOptions(snapshots, context) {
// reduce options into a single function
let applyOptions = [].concat(context?.options || [])
.reduceRight((next, { include, exclude, ...opts }) => snap => next(
// assign additional options to included snaphots
// assign additional options to included snapshots
snapshotMatches(snap, include, exclude) ? Object.assign(snap, opts) : snap
), snap => getSnapshotOptions(snap, context));

Expand Down Expand Up @@ -298,7 +298,7 @@ function mergeSnapshotOptions(prev = {}, next) {
let { resources: oldResources = [], ...existing } = prev;
let { resources: newResources = [], widths = [], width, ...incoming } = next;

// prioritize singular widths over mutilple widths
// prioritize singular widths over multiple widths
widths = width ? [width] : widths;

// deduplicate resources by associated widths and url
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/discovery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ describe('Discovery', () => {
});

describe('devicePixelRatio', () => {
it('should warn about depreacted option', async () => {
it('should warn about deprecated option', async () => {
await percy.snapshot({
name: 'test responsive',
url: 'http://localhost:8000',
Expand Down
Loading
Loading