Skip to content

Commit 191ec87

Browse files
committed
START-4 fix coverage paths better, ignore generated files, fix linting
1 parent e279e38 commit 191ec87

File tree

6 files changed

+27
-14
lines changed

6 files changed

+27
-14
lines changed

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ jobs:
4343
- uses: daun/playwright-report-summary@v3
4444
if: always()
4545
with:
46-
report-file: results.json
46+
report-file: playwright/results.json
4747
report-url: https://models-resources.concord.org/codap-plugin-starter-project/playwright-report/${{ steps.s3-deploy-path.outputs.deployPath }}/

codecov.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import playwright from "eslint-plugin-playwright";
2121
export default typescriptEslint.config(
2222
{
2323
name: "ignore dist and node_modules",
24-
ignores: ["dist/", "node_modules/", ".vscode/", "old.*"]
24+
ignores: ["dist/", "node_modules/", ".vscode/", "playwright-report/"]
2525
},
2626
js.configs.recommended,
2727
tsConfigs.recommended,

playwright.config.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,20 @@ const coverageReporter: ReporterDescription = [
2020
ignore them here. */
2121
"codap-plugin-starter-project/src/codap/**"
2222
],
23+
/* Modify the paths of files on which coverage is reported. This is run after
24+
the exclude filter, so it does not get any of the codap3 files.
25+
The paths returned by the v8 coverage have two issues which at least make them
26+
break the html report. They have an extra prefix of the project name so they
27+
look like `codap-plugin-starter-project/codap-plugin-starter-project/src`. They
28+
have a suffix like `?[random string]` like `App.tsx?c341`. */
29+
rewritePath: ({absolutePath}) => {
30+
// It isn't clear if this is before or after the exclude rule
31+
return (absolutePath as string)
32+
.replace("codap-plugin-starter-project/", "")
33+
.replace(/\?[0-9a-z]+$/,"");
34+
},
2335
/* Directory in which to write coverage reports */
24-
resultDir: path.join(__dirname, "results/e2e-coverage"),
36+
resultDir: path.join(__dirname, "playwright", "coverage"),
2537
/* Configure the reports to generate.
2638
The value is an array of istanbul reports, with optional configuration attached. */
2739
reports: [
@@ -50,7 +62,7 @@ const coverageReporter: ReporterDescription = [
5062
/* We report json in CI so the `daun/playwright-report-summary` action can add a summary of
5163
the results to a PR comment. */
5264
const reportJson = !!process.env.CI;
53-
const jsonReporter: ReporterDescription = ["json", { outputFile: "results.json" }];
65+
const jsonReporter: ReporterDescription = ["json", { outputFile: path.join("playwright", "results.json") }];
5466

5567
/**
5668
* See https://playwright.dev/docs/test-configuration.
@@ -68,6 +80,7 @@ export default defineConfig<PlaywrightCoverageOptions>({
6880
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
6981
reporter: [
7082
[ "html" ],
83+
[ "list" ],
7184
...(collectCoverage ? [coverageReporter] : []),
7285
...(reportJson ? [jsonReporter] : []),
7386
],

playwright/in-codap.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from "@playwright/test";
22
import { test } from "./fixtures";
33

4-
test("Test app inside of CODAP", async ({page}) => {
4+
test("App inside of CODAP", async ({page}) => {
55
await page.setViewportSize({width: 1400, height: 800});
66
await page.goto("https://codap3.concord.org/?mouseSensor&di=https://localhost:8080");
77

playwright/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"module": "NodeNext",
4+
"target": "es2022",
5+
"lib": ["es2022"],
6+
"types": ["node"]
7+
},
8+
"include": ["**/*.ts"]
9+
}

0 commit comments

Comments
 (0)