Skip to content

Commit

Permalink
Merge branch 'main' into huijbers/sourcemap-and-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 28, 2024
2 parents 646f49f + 62729ed commit 764cc2a
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 164 deletions.
17 changes: 16 additions & 1 deletion packages/aws-cdk/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config');
module.exports = {

const config = {
...baseConfig,
coverageThreshold: {
global: {
Expand All @@ -21,4 +22,18 @@ module.exports = {
// We have many tests here that commonly time out
testTimeout: 30_000,
setupFilesAfterEnv: ["<rootDir>/test/jest-setup-after-env.ts"],

// Randomize test order: this will catch tests that accidentally pass or
// fail because they rely on shared mutable state left by other tests
// (files on disk, global mocks, etc).
randomize: true,
};

// Disable coverage running in the VSCode debug terminal: we never want coverage
// when we're attaching a debugger because the coverage injection messes with
// the source maps.
if (process.env.VSCODE_INJECTION) {
config.collectCoverage = false;
}

module.exports = config;
23 changes: 11 additions & 12 deletions packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ export class AwsCliCompatible {
public static async credentialChainBuilder(
options: CredentialChainOptions = {},
): Promise<AwsCredentialIdentityProvider> {
const clientConfig = {
requestHandler: AwsCliCompatible.requestHandlerBuilder(options.httpOptions),
customUserAgent: 'aws-cdk',
logger: options.logger,
};

/**
* The previous implementation matched AWS CLI behavior:
*
Expand All @@ -41,16 +47,12 @@ export class AwsCliCompatible {
profile: options.profile,
ignoreCache: true,
mfaCodeProvider: tokenCodeFn,
clientConfig: {
requestHandler: AwsCliCompatible.requestHandlerBuilder(options.httpOptions),
customUserAgent: 'aws-cdk',
logger: options.logger,
},
clientConfig,
logger: options.logger,
});
}

const profile = options.profile || process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE;
const envProfile = process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE;

/**
* Env AWS - EnvironmentCredentials with string AWS
Expand All @@ -74,13 +76,10 @@ export class AwsCliCompatible {
* fromInstanceMetadata()
*/
const nodeProviderChain = fromNodeProviderChain({
profile: profile,
clientConfig: {
requestHandler: AwsCliCompatible.requestHandlerBuilder(options.httpOptions),
customUserAgent: 'aws-cdk',
logger: options.logger,
},
profile: envProfile,
clientConfig,
logger: options.logger,
mfaCodeProvider: tokenCodeFn,
ignoreCache: true,
});

Expand Down
Loading

0 comments on commit 764cc2a

Please sign in to comment.