Skip to content

Commit e9b5bb8

Browse files
Merge master into feature/q-dev-execution
2 parents 891f9e1 + c6e4516 commit e9b5bb8

File tree

21 files changed

+344
-252
lines changed

21 files changed

+344
-252
lines changed

.github/workflows/node.js.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
strategy:
4343
matrix:
44-
node-version: [16.x]
44+
node-version: [18.x]
4545
vscode-version: [stable]
4646
env:
4747
NODE_OPTIONS: '--max-old-space-size=8192'
@@ -62,7 +62,7 @@ jobs:
6262
strategy:
6363
fail-fast: false
6464
matrix:
65-
node-version: [16.x]
65+
node-version: [18.x]
6666
vscode-version: [minimum, stable, insiders]
6767
env:
6868
VSCODE_TEST_VERSION: ${{ matrix.vscode-version }}
@@ -110,7 +110,7 @@ jobs:
110110
strategy:
111111
fail-fast: true
112112
matrix:
113-
node-version: [16.x]
113+
node-version: [18.x]
114114
vscode-version: [stable, insiders]
115115
env:
116116
VSCODE_TEST_VERSION: ${{ matrix.vscode-version }}
@@ -136,7 +136,7 @@ jobs:
136136
strategy:
137137
fail-fast: false
138138
matrix:
139-
node-version: [16.x]
139+
node-version: [18.x]
140140
vscode-version: [stable, insiders]
141141
env:
142142
VSCODE_TEST_VERSION: ${{ matrix.vscode-version }}

buildspec/linuxIntegrationTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ phases:
2121
install:
2222
run-as: root
2323
runtime-versions:
24-
nodejs: 16
24+
nodejs: 18
2525
dotnet: 6.0
2626
java: latest
2727

buildspec/linuxTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ phases:
1818
install:
1919
run-as: root
2020
runtime-versions:
21-
nodejs: 16
21+
nodejs: 18
2222
commands:
2323
- bash buildspec/shared/linux-install.sh
2424

buildspec/packageTestVsix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ phases:
1313
install:
1414
run-as: root
1515
runtime-versions:
16-
nodejs: 16
16+
nodejs: 18
1717
commands:
1818
- bash buildspec/shared/linux-install.sh
1919

buildspec/windowsTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
phases:
66
install:
77
runtime-versions:
8-
nodejs: 16
8+
nodejs: 18
99
commands:
1010
- |
1111
if(-Not($Env:CODECOV_TOKEN -eq $null)) {

packages/core/scripts/test/launchTestUtilities.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,16 @@ async function invokeVSCodeCli(vsCodeExecutablePath: string, args: string[]): Pr
182182
}
183183

184184
console.log(`Invoking vscode CLI command:\n "${cli}" ${JSON.stringify(cmdArgs)}`)
185+
// Shell option must be true on windows to avoid security error: https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
185186
const spawnResult = proc.spawnSync(cli, cmdArgs, {
186187
encoding: 'utf-8',
187188
stdio: 'pipe',
189+
shell: process.platform === 'win32',
188190
})
189191

190192
if (spawnResult.status !== 0) {
191193
console.log('output: %s', spawnResult.output)
194+
console.log('error: %O', spawnResult.error)
192195
throw new Error(`VS Code CLI command failed (exit-code: ${spawnResult.status}): ${cli} ${cmdArgs}`)
193196
}
194197

packages/core/src/amazonqFeatureDev/util/files.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { AmazonqCreateUpload, Span, telemetry as amznTelemetry } from '../../sha
1818
import { TelemetryHelper } from './telemetryHelper'
1919
import { maxRepoSizeBytes } from '../constants'
2020
import { isCodeFile } from '../../shared/filetypes'
21+
import { fs } from '../../shared'
2122

2223
const getSha256 = (file: Buffer) => createHash('sha256').update(file).digest('base64')
2324

@@ -28,17 +29,17 @@ export async function prepareRepoData(
2829
repoRootPaths: string[],
2930
workspaceFolders: CurrentWsFolders,
3031
telemetry: TelemetryHelper,
31-
span: Span<AmazonqCreateUpload>
32+
span: Span<AmazonqCreateUpload>,
33+
zip: AdmZip = new AdmZip()
3234
) {
3335
try {
3436
const files = await collectFiles(repoRootPaths, workspaceFolders, true, maxRepoSizeBytes)
35-
const zip = new AdmZip()
3637

3738
let totalBytes = 0
3839
const ignoredExtensionMap = new Map<string, number>()
3940

4041
for (const file of files) {
41-
const fileSize = (await vscode.workspace.fs.stat(file.fileUri)).size
42+
const fileSize = (await fs.stat(file.fileUri)).size
4243
const isCodeFile_ = isCodeFile(file.relativeFilePath)
4344

4445
if (fileSize >= maxFileSizeBytes || !isCodeFile_) {

packages/core/src/codewhisperer/commands/startSecurityScan.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ export async function startSecurityScan(
9393
editor: vscode.TextEditor | undefined,
9494
client: DefaultCodeWhispererClient,
9595
context: vscode.ExtensionContext,
96-
scope: CodeWhispererConstants.CodeAnalysisScope
96+
scope: CodeWhispererConstants.CodeAnalysisScope,
97+
zipUtil: ZipUtil = new ZipUtil()
9798
) {
9899
const logger = getLoggerForScope(scope)
99100
/**
@@ -130,7 +131,6 @@ export async function startSecurityScan(
130131
* Step 1: Generate zip
131132
*/
132133
throwIfCancelled(scope, codeScanStartTime)
133-
const zipUtil = new ZipUtil()
134134
const zipMetadata = await zipUtil.generateZip(editor?.document.uri, scope)
135135
const projectPaths = zipUtil.getProjectPaths()
136136

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,15 @@ interface ZipCodeResult {
287287
fileSize: number
288288
}
289289

290-
export async function zipCode({ dependenciesFolder, humanInTheLoopFlag, modulePath, zipManifest }: IZipCodeParams) {
290+
export async function zipCode(
291+
{ dependenciesFolder, humanInTheLoopFlag, modulePath, zipManifest }: IZipCodeParams,
292+
zip: AdmZip = new AdmZip()
293+
) {
291294
let tempFilePath = undefined
292295
let logFilePath = undefined
293296
let dependenciesCopied = false
294297
try {
295298
throwIfCancelled()
296-
const zip = new AdmZip()
297299

298300
// If no modulePath is passed in, we are not uploaded the source folder
299301
// NOTE: We only upload dependencies for human in the loop work

packages/core/src/shared/performance/performance.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,11 @@ function assertPerformanceMetrics(
206206
`Expected total duration for ${name} to be less than ${expectedDuration}. Actual duration was ${foundDuration}`
207207
)
208208
}
209+
210+
export function getEqualOSTestOptions(testOptions: Partial<PerformanceMetrics>): Partial<TestOptions> {
211+
return {
212+
linux: testOptions,
213+
darwin: testOptions,
214+
win32: testOptions,
215+
}
216+
}

0 commit comments

Comments
 (0)