Skip to content

Commit 747e806

Browse files
authored
test codewhisperer coverage changes (aws#5334)
* fix: Codewhisperer underreporting codecoverage Problem: - Codewhisperer was underreporting code coverage because c8 couldn't "see" the code in core Solution: - Use --allowExternal which allows c8 to report codecoverage on code outside of the cwd Other notes: - As far as I can tell/understand include isn't really necessary since we're using the "all" flag which considers all files in the cwd, --allowExternal which allows for src files to be outside of the amazonq directory (so it can see and report on the amazonq/codewhisperer test files), and exclude which specifically excludes certain files from the report
1 parent 1c1b0bf commit 747e806

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/amazonq/.c8rc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
"report-dir": "../../coverage/amazonq",
33
"reporter": ["lcov"],
44
"all": true,
5-
"include": ["src/**", "dist/src/**"],
6-
"exclude": ["dist/test/**", "src/test/**"]
5+
"exclude": ["**/test*/**", "**/node_modules/**"]
76
}

packages/amazonq/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
"lint": "true",
5858
"watch": "npm run clean && npm run buildScripts && tsc -watch -p ./",
5959
"testCompile": "npm run clean && npm run buildScripts && npm run compileOnly",
60-
"test": "npm run testCompile && c8 ts-node ../core/scripts/test/test.ts dist/test/unit/index.js ../core/dist/src/testFixtures/workspaceFolder",
61-
"testE2E": "npm run testCompile && c8 ts-node ../core/scripts/test/testE2E.ts dist/test/e2e/index.js ../core/dist/src/testFixtures/workspaceFolder",
60+
"test": "npm run testCompile && c8 --allowExternal ts-node ../core/scripts/test/test.ts dist/test/unit/index.js ../core/dist/src/testFixtures/workspaceFolder",
61+
"testE2E": "npm run testCompile && c8 --allowExternal ts-node ../core/scripts/test/testE2E.ts dist/test/e2e/index.js ../core/dist/src/testFixtures/workspaceFolder",
6262
"webRun": "npx @vscode/test-web --open-devtools --browserOption=--disable-web-security --waitForDebugger=9222 --extensionDevelopmentPath=. .",
6363
"webWatch": "npm run clean && npm run buildScripts && webpack --mode development --watch",
6464
"serve": "webpack serve --config-name mainServe --mode development",

0 commit comments

Comments
 (0)