@percy/core
Version:
The core component of Percy's CLI and SDKs that handles creating builds, discovering snapshot assets, uploading snapshots, and finalizing builds. Uses `@percy/client` for API communication, a Chromium browser for asset discovery, and starts a local API se
36 lines (31 loc) • 971 B
JavaScript
import { resetPercyConfig, mockfs as mfs, fs } from '@percy/config/test/helpers';
import logger from '@percy/logger/test/helpers';
import api from '@percy/client/test/helpers';
import path from 'path';
import url from 'url';
export function mockfs(initial) {
return mfs({
...initial,
$bypass: [
path.resolve(url.fileURLToPath(import.meta.url), '/../../../dom/dist/bundle.js'),
path.resolve(url.fileURLToPath(import.meta.url), '../secretPatterns.yml'),
p => p.includes?.('.local-chromium'),
...(initial?.$bypass ?? [])
]
});
}
export async function setupTest({
resetConfig,
filesystem,
loggerTTY,
apiDelay
} = {}) {
await api.mock({ delay: apiDelay });
await logger.mock({ isTTY: loggerTTY });
await resetPercyConfig(resetConfig);
await mockfs(filesystem);
}
export * from '@percy/client/test/helpers';
export { createTestServer } from './server.js';
export { dedent } from './dedent.js';
export { logger, fs };