Skip to content

Commit cbc19a0

Browse files
authored
Merge pull request #6653 from aws/autoMerge/feature/sdkv3
Merge master into feature/sdkv3
2 parents 80c4367 + b77d700 commit cbc19a0

File tree

30 files changed

+402
-671
lines changed

30 files changed

+402
-671
lines changed

package-lock.json

Lines changed: 177 additions & 542 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q /test: Unit test generation displays an inaccurate diff view for non-primary packages in the workspace."
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q /doc: Fix uploading file method throwing incorrect workspace too large error message"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "/transform: skip running tests locally when user chooses to do so"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "/review: ignored lines should not show up in scan issues"
4+
}

packages/amazonq/test/e2e/amazonq/transformByQ.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ describe('Amazon Q Code Transformation', function () {
162162
const tmpDir = (await TestFolder.create()).path
163163

164164
transformByQState.setSummaryFilePath(path.join(tmpDir, 'summary.md'))
165+
transformByQState.setToPartiallySucceeded()
165166

166167
transformByQState
167168
.getChatMessenger()

packages/amazonq/test/unit/amazonqFeatureDev/util/files.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ import {
88
prepareRepoData,
99
PrepareRepoDataOptions,
1010
TelemetryHelper,
11-
ContentLengthError,
1211
maxRepoSizeBytes,
1312
} from 'aws-core-vscode/amazonqFeatureDev'
1413
import { assertTelemetry, getWorkspaceFolder, TestFolder } from 'aws-core-vscode/test'
1514
import { fs, AmazonqCreateUpload, ZipStream } from 'aws-core-vscode/shared'
1615
import { MetricName, Span } from 'aws-core-vscode/telemetry'
1716
import sinon from 'sinon'
1817
import { CodeWhispererSettings } from 'aws-core-vscode/codewhisperer'
19-
import { CurrentWsFolders } from 'aws-core-vscode/amazonq'
18+
import { ContentLengthError, CurrentWsFolders } from 'aws-core-vscode/amazonq'
2019
import path from 'path'
2120

2221
const testDevfilePrepareRepo = async (devfileEnabled: boolean) => {

packages/amazonq/test/unit/codewhisperer/service/securityScanHandler.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { timeoutUtils } from 'aws-core-vscode/shared'
2020
import assert from 'assert'
2121
import sinon from 'sinon'
2222
import * as vscode from 'vscode'
23-
import fs from 'fs' // eslint-disable-line no-restricted-imports
23+
import path from 'path'
2424

2525
const buildRawCodeScanIssue = (params?: Partial<RawCodeScanIssue>): RawCodeScanIssue => ({
2626
filePath: 'workspaceFolder/python3.7-plain-sam-app/hello_world/app.py',
@@ -65,17 +65,18 @@ const buildMockListCodeScanFindingsResponse = (
6565
nextToken: nextToken ? 'nextToken' : undefined,
6666
})
6767

68+
function getWorkspaceFolder(): string {
69+
return (
70+
vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ??
71+
path.join(__dirname, '../../../../../../core/src/testFixtures/workspaceFolder')
72+
)
73+
}
74+
6875
describe('securityScanHandler', function () {
6976
describe('listScanResults', function () {
7077
let mockClient: Stub<DefaultCodeWhispererClient>
7178
beforeEach(function () {
7279
mockClient = stub(DefaultCodeWhispererClient)
73-
sinon.stub(fs, 'existsSync').returns(true)
74-
sinon.stub(fs, 'statSync').returns({ isFile: () => true } as fs.Stats)
75-
})
76-
77-
afterEach(function () {
78-
sinon.restore()
7980
})
8081

8182
it('should make ListCodeScanFindings request and aggregate findings by file path', async function () {
@@ -85,14 +86,13 @@ describe('securityScanHandler', function () {
8586
mockClient,
8687
'jobId',
8788
'codeScanFindingsSchema',
88-
['projectPath'],
89+
[getWorkspaceFolder()],
8990
CodeAnalysisScope.PROJECT,
9091
undefined
9192
)
9293

93-
assert.equal(aggregatedCodeScanIssueList.length, 2)
94+
assert.equal(aggregatedCodeScanIssueList.length, 1)
9495
assert.equal(aggregatedCodeScanIssueList[0].issues.length, 1)
95-
assert.equal(aggregatedCodeScanIssueList[1].issues.length, 1)
9696
})
9797

9898
it('should handle ListCodeScanFindings request with paginated response', async function () {
@@ -123,12 +123,12 @@ describe('securityScanHandler', function () {
123123
mockClient,
124124
'jobId',
125125
'codeScanFindingsSchema',
126-
['projectPath'],
126+
[getWorkspaceFolder()],
127127
CodeAnalysisScope.PROJECT,
128128
undefined
129129
)
130130

131-
assert.equal(aggregatedCodeScanIssueList.length, 2)
131+
assert.equal(aggregatedCodeScanIssueList.length, 1)
132132
assert.equal(aggregatedCodeScanIssueList[0].issues.length, 3)
133133
})
134134

@@ -145,7 +145,7 @@ describe('securityScanHandler', function () {
145145
mockClient,
146146
'jobId',
147147
'codeScanFindingsSchema',
148-
['projectPath'],
148+
[getWorkspaceFolder()],
149149
scope,
150150
undefined
151151
)

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@
473473
"c8": "^9.0.0",
474474
"circular-dependency-plugin": "^5.2.2",
475475
"css-loader": "^6.10.0",
476-
"esbuild-loader": "^4.3.0",
476+
"esbuild-loader": "2.20.0",
477477
"file-loader": "^6.2.0",
478478
"jsdom": "^23.0.1",
479479
"json-schema-to-typescript": "^13.1.1",
@@ -524,7 +524,7 @@
524524
"@vscode/debugprotocol": "^1.57.0",
525525
"@zip.js/zip.js": "^2.7.41",
526526
"adm-zip": "^0.5.10",
527-
"amazon-states-language-service": "^1.15.0",
527+
"amazon-states-language-service": "^1.16.1",
528528
"async-lock": "^1.4.0",
529529
"aws-sdk": "^2.1692.0",
530530
"aws-ssm-document-language-service": "^1.0.0",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
*/
6+
7+
/**
8+
* Shared error type for content length validation.
9+
* When thrown from common components, individual agents can catch and transform this error
10+
* to provide their own customized error messages.
11+
*/
12+
import { ToolkitError } from '../shared/errors'
13+
14+
export class ContentLengthError extends ToolkitError {
15+
constructor(message: string) {
16+
super(message, { code: 'ContentLengthError' })
17+
}
18+
}

0 commit comments

Comments
 (0)