Skip to content

Commit 4421290

Browse files
dhasani23David Hasani
andauthored
fix(amazonq): skip tests locally (aws#6658)
## Problem When users choose to skip tests, we were skipping them on our server by passing in their choice to our backend, but we weren't also skipping them locally. ## Solution Tell Maven to use `-DskipTests` --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. Co-authored-by: David Hasani <[email protected]>
1 parent 91a54b0 commit 4421290

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed
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+
}

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/core/src/amazonqGumby/chat/controller/messenger/messenger.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ export class Messenger {
124124
title: CodeWhispererConstants.skipUnitTestsFormTitle,
125125
mandatory: true,
126126
options: [
127-
{
128-
value: CodeWhispererConstants.runUnitTestsMessage,
129-
label: CodeWhispererConstants.runUnitTestsMessage,
130-
},
131127
{
132128
value: CodeWhispererConstants.skipUnitTestsMessage,
133129
label: CodeWhispererConstants.skipUnitTestsMessage,
134130
},
131+
{
132+
value: CodeWhispererConstants.runUnitTestsMessage,
133+
label: CodeWhispererConstants.runUnitTestsMessage,
134+
},
135135
],
136136
})
137137

@@ -533,7 +533,7 @@ export class Messenger {
533533
})
534534
}
535535

536-
if (transformByQState.getSummaryFilePath()) {
536+
if (transformByQState.isPartiallySucceeded() || transformByQState.isSucceeded()) {
537537
buttons.push({
538538
keepCardAfterClick: true,
539539
text: CodeWhispererConstants.viewSummaryButtonText,

packages/core/src/codewhisperer/service/transformByQ/transformMavenHandler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ function installProjectDependencies(dependenciesFolder: FolderInfo, modulePath:
2727

2828
// Note: IntelliJ runs 'clean' separately from 'install'. Evaluate benefits (if any) of this.
2929
const args = [`-Dmaven.repo.local=${dependenciesFolder.path}`, 'clean', 'install', '-q']
30+
31+
if (transformByQState.getCustomBuildCommand() === CodeWhispererConstants.skipUnitTestsBuildCommand) {
32+
args.push('-DskipTests')
33+
}
34+
3035
let environment = process.env
3136

3237
if (transformByQState.getJavaHome() !== undefined) {

0 commit comments

Comments
 (0)