@@ -2,20 +2,41 @@ import path from "path"
22import { fileURLToPath } from "url"
33
44import { defineConfig } from "@playwright/experimental-ct-react"
5+ import type { ReporterDescription } from "@playwright/test"
56import react from "@vitejs/plugin-react"
67import tailwindcss from "@tailwindcss/vite"
78
89const dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
910
11+ const monocartCoverageReporter : ReporterDescription = [
12+ "monocart-coverage-reports" ,
13+ {
14+ name : "Webview Playwright CT Coverage" ,
15+ outputDir : path . resolve ( dirname , "coverage-ct" ) ,
16+ reports : [ "lcov" , "html" ] ,
17+ entryFilter : ( entry : { url : string } ) => entry . url . includes ( "/src/" ) ,
18+ sourceFilter : ( sourcePath : string ) => sourcePath . includes ( "src/" ) ,
19+ } ,
20+ ]
21+
1022export default defineConfig ( {
1123 testDir : "./src" ,
1224 testMatch : "**/*.visual.tsx" ,
1325 outputDir : process . env . CI ? path . resolve ( dirname , "test-results" ) : "/tmp/webview-ui-playwright-test-results" ,
1426 snapshotPathTemplate : "{testDir}/{testFileDir}/__screenshots__/{arg}{ext}" ,
1527 fullyParallel : true ,
1628 reporter : process . env . CI
17- ? [ [ "html" , { open : "never" , outputFolder : path . resolve ( dirname , "playwright-report" ) } ] , [ "github" ] , [ "list" ] ]
18- : [ [ "html" , { open : "never" , outputFolder : "/tmp/webview-ui-playwright-report" } ] , [ "list" ] ] ,
29+ ? [
30+ [ "html" , { open : "never" , outputFolder : path . resolve ( dirname , "playwright-report" ) } ] ,
31+ [ "github" ] ,
32+ [ "list" ] ,
33+ monocartCoverageReporter ,
34+ ]
35+ : [
36+ [ "html" , { open : "never" , outputFolder : "/tmp/webview-ui-playwright-report" } ] ,
37+ [ "list" ] ,
38+ monocartCoverageReporter ,
39+ ] ,
1940 use : {
2041 ctTemplateDir : "./playwright" ,
2142 ctViteConfig : {
@@ -44,6 +65,7 @@ export default defineConfig({
4465 "process.env.PKG_RELEASE_CHANNEL" : JSON . stringify ( "stable" ) ,
4566 } ,
4667 optimizeDeps : {
68+ include : [ "@vscode/webview-ui-toolkit" ] ,
4769 exclude : [ "@vscode/codicons" ] ,
4870 } ,
4971 } ,
0 commit comments