Skip to content

Commit 8263789

Browse files
committed
update calls to fs read
1 parent 552afa6 commit 8263789

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

packages/core/src/shared/crashMonitoring.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ export class FileSystemState {
506506
// we will assume that other instance handled its termination appropriately.
507507
const ext = await withFailCtx('parseRunningExtFile', async () =>
508508
ignoreBadFileError(async () => {
509-
const text = await fs.readFileAsString(path.join(await this.runningExtsDir(), extId))
509+
const text = await fs.readFileText(path.join(await this.runningExtsDir(), extId))
510510

511511
if (!text) {
512512
return undefined

packages/core/src/test/credentials/sso/cache.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('SSO Cache', function () {
4747
await cache.save({ startUrl, region }, validRegistration)
4848

4949
const cachedPath = path.join(testDir, `aws-toolkit-vscode-client-id-${region}.json`)
50-
const contents = await fs.readFileAsString(cachedPath)
50+
const contents = await fs.readFileText(cachedPath)
5151

5252
assert.deepStrictEqual(JSON.parse(contents), {
5353
...validRegistration,
@@ -70,7 +70,7 @@ describe('SSO Cache', function () {
7070

7171
// SHA-1 hash of the encoded start URL `https://123456.awsapps.com/start`
7272
const cachedPath = path.join(testDir, 'c1ac99f782ad92755c6de8647b510ec247330ad1.json')
73-
const contents = await fs.readFileAsString(cachedPath)
73+
const contents = await fs.readFileText(cachedPath)
7474

7575
assert.deepStrictEqual(JSON.parse(contents), {
7676
region,

packages/core/src/test/shared/sam/debugger/samDebugConfigProvider.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,10 +2172,7 @@ describe('SamDebugConfigurationProvider', async function () {
21722172
}
21732173

21742174
assertEqualLaunchConfigs(actual, expected)
2175-
assert.strictEqual(
2176-
await fs.readFileAsString(actual.eventPayloadFile!),
2177-
await fs.readFileAsString(absPayloadPath)
2178-
)
2175+
assert.strictEqual(await fs.readFileText(actual.eventPayloadFile!), await fs.readFileText(absPayloadPath))
21792176
await assertFileText(
21802177
expected.templatePath,
21812178
`Resources:
@@ -2698,8 +2695,8 @@ describe('SamDebugConfigurationProvider', async function () {
26982695

26992696
assertEqualLaunchConfigs(actual, expected)
27002697
assert.strictEqual(
2701-
await fs.readFileAsString(actual.eventPayloadFile!),
2702-
await fs.readFileAsString(input.lambda.payload.path)
2698+
await fs.readFileText(actual.eventPayloadFile!),
2699+
await fs.readFileText(input.lambda.payload.path)
27032700
)
27042701
await assertFileText(
27052702
expected.templatePath,

packages/core/src/testE2E/amazonqGumby/transformByQ.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('transformByQ', async function () {
5252
})
5353

5454
it('WHEN upload payload with missing sha256 in headers THEN fails to upload', async function () {
55-
const buffer = Buffer.from(await fs.readFile(zippedCodePath))
55+
const buffer = Buffer.from(await fs.readFileBytes(zippedCodePath))
5656
const sha256 = getSha256(buffer)
5757
const response = await codeWhisperer.codeWhispererClient.createUploadUrl({
5858
contentChecksum: sha256,
@@ -63,7 +63,7 @@ describe('transformByQ', async function () {
6363
'x-amz-checksum-sha256': '',
6464
'Content-Type': 'application/zip',
6565
}
66-
const body = await fs.readFileAsString(zippedCodePath)
66+
const body = await fs.readFileText(zippedCodePath)
6767
await assert.rejects(
6868
() =>
6969
request.fetch('PUT', response.uploadUrl, {
@@ -88,7 +88,7 @@ describe('transformByQ', async function () {
8888
})
8989

9090
it('WHEN createUploadUrl THEN URL uses HTTPS and sets 60 second expiration', async function () {
91-
const buffer = Buffer.from(await fs.readFile(zippedCodePath))
91+
const buffer = Buffer.from(await fs.readFileBytes(zippedCodePath))
9292
const sha256 = getSha256(buffer)
9393
const response = await codeWhisperer.codeWhispererClient.createUploadUrl({
9494
contentChecksum: sha256,

0 commit comments

Comments
 (0)