Skip to content

Commit 56db232

Browse files
Fix test failures.
1 parent 7b4b83a commit 56db232

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/platforms/aws/models/awsConfig.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import type { IIniObject, IIniObjectSection } from "js-ini";
77

88
import { UserConfigurationError } from "../../../utils/errors.ts";
99

10-
const AWS_CONFIG_FILE = path.join(os.homedir(), ".aws", "config");
10+
const DEFAULT_AWS_CONFIG_FILE = path.join(os.homedir(), ".aws", "config");
1111

1212
/** Last-resort region when neither the call nor the profile supplies one. */
1313
const DEFAULT_REGION = "us-east-1";
1414

1515
/** Read and parse the AWS config file */
1616
function readAWSConfigFile(): IIniObject {
1717
try {
18-
const configContent = fs.readFileSync(AWS_CONFIG_FILE, "utf-8");
18+
const configContent = fs.readFileSync(AWSConfig.AWS_CONFIG_FILE, "utf-8");
1919
return parse(configContent, { comment: [";", "#"] });
2020
} catch (error: unknown) {
2121
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
@@ -48,6 +48,12 @@ function getSectionForProfile(profile: string): IIniObjectSection | undefined {
4848
* profiles and regions.
4949
*/
5050
const AWSConfig = {
51+
/**
52+
* Path to the AWS config file. Exposed as a mutable property so tests can
53+
* repoint it at a fixture file instead of the developer's real config.
54+
*/
55+
AWS_CONFIG_FILE: DEFAULT_AWS_CONFIG_FILE,
56+
5157
/**
5258
* Return the names of profiles found in the AWS config file. This will include 'default'
5359
* as the name of the default profile.

src/plugins/resource-browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default createPlugin(
1818
localStackStatusTracker,
1919
outputChannel,
2020
);
21-
const resourcesProvider = new ResourceViewProvider(context);
21+
const resourcesProvider = new ResourceViewProvider();
2222
const detailsProvider = new ResourceDetailsViewProvider();
2323

2424
/* Resources is a tree view; Resource Details is a webview (table layout). */

0 commit comments

Comments
 (0)