Skip to content

Commit

Permalink
test(karma-credential-loader): set credential expiration as date (#6353)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Aug 2, 2024
1 parent 253d329 commit 80cb054
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/karma-credential-loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ function createCredentialPreprocessor() {
})();
// This will affect the generated (ES5) JS
const regionCode = `var defaultRegion = '${region}';`;
const credentialsCode = `var credentials = ${JSON.stringify(credentials)};`;
let credentialsCode = `var credentials = ${JSON.stringify(credentials)};
delete credentials.expiration;`;

if (Number.isInteger(credentials.expiration?.getTime?.())) {
credentialsCode += `
credentials.expiration = new Date(${credentials.expiration!.getTime()});`;
}

const isBrowser = `var isBrowser = true;`;
const contents = content.split("\n");
let idx = -1;
Expand Down

0 comments on commit 80cb054

Please sign in to comment.