Skip to content

Commit a096830

Browse files
authored
chore(toolkit-lib): diff test fails if AWS credentials set (#381)
The `diff.test` times out trying to get the current account from actual AWS credentials, if they happen to be in the environment where unit tests are run. Make sure a fake SDK provider is used that doesn't do any of that stuff. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent 1b5c2ed commit a096830

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/@aws-cdk/toolkit-lib/test/actions/diff.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { RequireApproval } from '../../lib/api/shared-private';
66
import { StackSelectionStrategy } from '../../lib/api/shared-public';
77
import { Toolkit } from '../../lib/toolkit';
88
import { builderFixture, disposableCloudAssemblySource, TestIoHost } from '../_helpers';
9+
import { MockSdkProvider } from '../_helpers/mock-sdk';
910

1011
let ioHost: TestIoHost;
1112
let toolkit: Toolkit;
@@ -18,6 +19,8 @@ beforeEach(() => {
1819
toolkit = new Toolkit({ ioHost });
1920

2021
// Some default implementations
22+
jest.spyOn(apis.SdkProvider, 'withAwsCliCompatibleDefaults').mockResolvedValue(new MockSdkProvider());
23+
2124
jest.spyOn(apis.Deployments.prototype, 'readCurrentTemplateWithNestedStacks').mockResolvedValue({
2225
deployedRootTemplate: {
2326
Parameters: {},

0 commit comments

Comments
 (0)