Skip to content

Commit ec4c7b3

Browse files
Merge master into feature/cwltail
2 parents 01dc7a8 + ccba819 commit ec4c7b3

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

packages/core/src/test/testRunner.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function runTests(
2222
testFolder: string | string[],
2323
extensionId: string,
2424
initTests: string[] = [],
25-
testFiles?: string[]
25+
options?: { retries?: number; testFiles?: string[] }
2626
): Promise<void> {
2727
if (!process.env['AWS_TOOLKIT_AUTOMATION']) {
2828
throw new Error('Expected the "AWS_TOOLKIT_AUTOMATION" environment variable to be set for tests.')
@@ -79,6 +79,7 @@ export async function runTests(
7979
mochaFile: outputFile,
8080
},
8181
},
82+
retries: options?.retries ?? 0,
8283
timeout: 0,
8384
})
8485

@@ -91,7 +92,7 @@ export async function runTests(
9192
testFilePath = testFile ? path.resolve(dist, testFile) : undefined
9293
}
9394

94-
if (testFile && testFiles) {
95+
if (testFile && options?.testFiles) {
9596
throw new Error('Individual file and list of files given to run tests on. One must be chosen.')
9697
}
9798

@@ -143,8 +144,8 @@ export async function runTests(
143144
}
144145

145146
let files: string[] = []
146-
if (testFiles) {
147-
files = testFiles
147+
if (options?.testFiles) {
148+
files = options.testFiles
148149
} else {
149150
for (const f of Array.isArray(testFolder) ? testFolder : [testFolder]) {
150151
files = [...files, ...(await glob(testFilePath ?? `**/${f}/**/**.test.js`, { cwd: dist }))]

packages/toolkit/test/unit/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { runTests } from 'aws-core-vscode/test'
77
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
88

99
export function run(): Promise<void> {
10-
return runTests(process.env.TEST_DIR ?? ['test/unit', '../../core/dist/src/test'], VSCODE_EXTENSION_ID.awstoolkit, [
11-
'../../core/dist/src/test/globalSetup.test.ts',
12-
])
10+
return runTests(
11+
process.env.TEST_DIR ?? ['test/unit', '../../core/dist/src/test'],
12+
VSCODE_EXTENSION_ID.awstoolkit,
13+
['../../core/dist/src/test/globalSetup.test.ts'],
14+
{ retries: 3 }
15+
)
1316
}

0 commit comments

Comments
 (0)