Skip to content

Commit 391b2b8

Browse files
authored
tests: add script for running amazon q e2e tests (aws#5100)
Problem: - Running `npm run testE2E` from the root doesn't run the amazon q e2e folders Solution: - Add a `testE2E` script`
1 parent 3974bcf commit 391b2b8

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

packages/amazonq/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,14 @@
5252
"syncPackageJson": "ts-node ./scripts/build/syncPackageJson.ts",
5353
"clean": "ts-node ../../scripts/clean.ts dist/ LICENSE NOTICE",
5454
"compile": "npm run clean && npm run buildScripts && webpack --mode development",
55+
"compileOnly": "tsc -p ./",
5556
"package": "ts-node ../../scripts/package.ts",
5657
"format": "prettier --ignore-path ../../.prettierignore --check src scripts",
5758
"formatfix": "prettier --ignore-path ../../.prettierignore --write src scripts",
5859
"lint": "echo 'Nothing to lint yet!'",
5960
"watch": "npm run clean && npm run buildScripts && tsc -watch -p ./",
61+
"testCompile": "npm run clean && npm run buildScripts && npm run compileOnly",
62+
"testE2E": "npm run testCompile && c8 ts-node ../core/scripts/test/testE2E.ts dist/test/e2e/index.js",
6063
"webRun": "npx @vscode/test-web --open-devtools --browserOption=--disable-web-security --waitForDebugger=9222 --extensionDevelopmentPath=. .",
6164
"webWatch": "npm run clean && npm run buildScripts && webpack --mode development --watch",
6265
"serve": "webpack serve --config-name mainServe --mode development",

packages/amazonq/test/e2e/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
88

99
export function run(): Promise<void> {
1010
return runTests(
11-
process.env.TEST_DIR ?? 'src/testE2E',
11+
process.env.TEST_DIR ?? 'test/e2e',
1212
['../../core/dist/src/testInteg/globalSetup.test.ts'],
1313
VSCODE_EXTENSION_ID.amazonq
1414
)

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3954,7 +3954,7 @@
39543954
"testCompile": "npm run clean && npm run buildScripts && npm run compileOnly",
39553955
"test": "npm run testCompile && c8 ts-node ./scripts/test/test.ts",
39563956
"testWeb": "npm run compileDev && c8 ts-node ./scripts/test/testWeb.ts",
3957-
"testE2E": "npm run testCompile && c8 ts-node ./scripts/test/testE2E.ts",
3957+
"testE2E": "npm run testCompile && c8 ts-node ./scripts/test/testE2E.ts dist/src/testE2E/index.js",
39583958
"testInteg": "npm run testCompile && c8 ts-node ./scripts/test/testInteg.ts",
39593959
"format": "prettier --ignore-path ../../.prettierignore --check src scripts",
39603960
"formatfix": "prettier --ignore-path ../../.prettierignore --write src scripts",

packages/core/scripts/test/testE2E.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@
55

66
import { runToolkitTests } from './launchTestUtilities'
77
void (async () => {
8-
await runToolkitTests('e2e', 'dist/src/testE2E/index.js')
8+
const relativeEntrypoint = process.argv[2]
9+
if (!relativeEntrypoint) {
10+
throw new Error('Relative entrypoint is required')
11+
}
12+
await runToolkitTests('e2e', relativeEntrypoint)
913
})()

0 commit comments

Comments
 (0)