Skip to content

Commit

Permalink
fix(playwright): make getCSPScriptHash synchronous
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Oct 29, 2024
1 parent fe6e055 commit 86f3ee3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/playwright/src/csp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createHash } from "node:crypto";
/**
* Get the CSP script hash.
*/
export async function getCSPScriptHash() {
export function getCSPScriptHash() {
const hash = createHash("sha256").update(getGlobalScript()).digest("base64");
return `'sha256-${hash}'`;
}
12 changes: 0 additions & 12 deletions packages/playwright/src/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,3 @@ const argosScreenshot = async (...args) => {
return argosScreenshot(...args);
};
exports.argosScreenshot = argosScreenshot;

const getCSPScriptHash = async (...args) => {
const { getCSPScriptHash } = await import("./index.js");
return getCSPScriptHash(...args);
};
exports.getCSPScriptHash = getCSPScriptHash;

const DO_NOT_USE_setMetadataConfig = async (...args) => {
const { DO_NOT_USE_setMetadataConfig } = await import("./index.js");
return DO_NOT_USE_setMetadataConfig(...args);
};
exports.DO_NOT_USE_setMetadataConfig = DO_NOT_USE_setMetadataConfig;
2 changes: 1 addition & 1 deletion packages/playwright/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const metadataConfigStorage = new AsyncLocalStorage<MetadataConfig>();
/**
* Set the metadata config.
*/
export async function setMetadataConfig(metadata: MetadataConfig) {
export function setMetadataConfig(metadata: MetadataConfig) {
metadataConfigStorage.enterWith(metadata);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function argosScreenshot(

const version = await getArgosStorybookVersion();

await DO_NOT_USE_setMetadataConfig({
DO_NOT_USE_setMetadataConfig({
sdk: { name: "@argos-ci/storybook", version },
playwrightLibraries: ["@storybook/test-runner"],
});
Expand Down

0 comments on commit 86f3ee3

Please sign in to comment.