Skip to content

Commit

Permalink
Option name changed
Browse files Browse the repository at this point in the history
  • Loading branch information
skitterm committed Nov 16, 2023
1 parent e30106e commit 88a0f67
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/playwright-api/makeTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const makeTest = (
pauseAnimationAtEnd: [undefined, { option: true }],
prefersReducedMotion: [undefined, { option: true }],
resourceArchiveTimeout: [DEFAULT_GLOBAL_RESOURCE_ARCHIVE_TIMEOUT_MS, { option: true }],
allowedExternalDomains: [[], { option: true }],
allowedArchiveDomains: [[], { option: true }],

save: [
async (
Expand All @@ -47,7 +47,7 @@ export const makeTest = (
pauseAnimationAtEnd,
prefersReducedMotion,
resourceArchiveTimeout,
allowedExternalDomains,
allowedArchiveDomains,
},
use,
testInfo
Expand All @@ -66,7 +66,7 @@ export const makeTest = (
const completeArchive = await createResourceArchive({
page,
networkTimeout: resourceArchiveTimeout,
allowedExternalDomains,
allowedArchiveDomains,
});
await use();

Expand Down
2 changes: 1 addition & 1 deletion src/resource-archive/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ describe('new', () => {

const complete = await createResourceArchive({
page,
allowedExternalDomains: [
allowedArchiveDomains: [
// external origins we allow-list
'https://i-ama.fake',
'https://another-domain.com',
Expand Down
12 changes: 6 additions & 6 deletions src/resource-archive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Watcher {
Specifies which domains (origins) we should archive resources for (by default we only archive same-origin resources).
Useful in situations where the environment running the archived storybook (e.g. in CI) may be restricted to an intranet or other domain restrictions
*/
private allowedExternalDomains: string[];
private allowedArchiveDomains: string[];

/**
* We assume the first URL loaded after @watch is called is the base URL of the
Expand All @@ -51,7 +51,7 @@ class Watcher {
allowedDomains?: string[]
) {
this.globalNetworkTimeoutMs = networkTimeoutMs;
this.allowedExternalDomains = allowedDomains || [];
this.allowedArchiveDomains = allowedDomains || [];
}

async watch() {
Expand Down Expand Up @@ -141,7 +141,7 @@ class Watcher {

const isRequestFromAllowedDomain =
requestUrl.origin === this.firstUrl.origin ||
this.allowedExternalDomains.includes(requestUrl.origin);
this.allowedArchiveDomains.includes(requestUrl.origin);

logger.log(
'requestPaused',
Expand Down Expand Up @@ -229,16 +229,16 @@ class Watcher {
export async function createResourceArchive({
page,
networkTimeout,
allowedExternalDomains,
allowedArchiveDomains,
}: {
page: Page;
networkTimeout?: number;
allowedExternalDomains?: string[];
allowedArchiveDomains?: string[];
}): Promise<() => Promise<ResourceArchive>> {
const watcher = new Watcher(
page,
networkTimeout ?? DEFAULT_GLOBAL_RESOURCE_ARCHIVE_TIMEOUT_MS,
allowedExternalDomains
allowedArchiveDomains
);
await watcher.watch();

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface ChromaticConfig {
// domains (besides localhost) that assets should be archived from
// (needed when, for example, CI environment can't access the archives later on)
// ex: https://www.some-domain.com
allowedExternalDomains?: string[];
allowedArchiveDomains?: string[];
}

export interface ChromaticStorybookParameters extends Omit<ChromaticConfig, 'disableAutoCapture'> {
Expand Down

0 comments on commit 88a0f67

Please sign in to comment.