A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
ci: report frontend test coverage on pull requests (#10273)
Myles Scolnickcb0c9350bd5a
diff --git a/.github/workflows/test_fe.yaml b/.github/workflows/test_fe.yamlindex ab15344abd..5b7310c8ba 100644--- a/.github/workflows/test_fe.yaml+++ b/.github/workflows/test_fe.yaml@@ -118,6 +118,7 @@ jobs:permissions:contents: readid-token: write # required for Doppler OIDC+ pull-requests: write # required to post the coverage report commentdefaults:run:working-directory: ./frontend@@ -168,7 +169,22 @@ jobs:id: testenv:TURBO_TOKEN: ${{ steps.secrets.outputs.TURBO_TOKEN }}- run: pnpm turbo test+ run: pnpm turbo test:coverage++ - name: 📊 Report coverage+ # Runs even when tests fail (reportOnFailure writes the summary anyway).+ # Fork PRs run with a read-only GITHUB_TOKEN, so posting the comment+ # fails with 403 — don't fail the check for external contributors.+ if: always()+ continue-on-error: true+ uses: davelosert/vitest-coverage-report-action@3c50566c523e04813df28de8f7c48dd97d663f1c # v2+ with:+ # Paths below are resolved relative to working-directory, so the+ # effective locations are ./frontend/coverage/*.json (where vitest+ # writes them — verified locally).+ working-directory: ./frontend+ json-summary-path: coverage/coverage-summary.json+ json-final-path: coverage/coverage-final.json- name: Summarize typecheck failureif: failure() && steps.typecheck.outcome == 'failure'diff --git a/frontend/.gitignore b/frontend/.gitignoreindex 5c4ffa21fa..e0ed053c5b 100644--- a/frontend/.gitignore+++ b/frontend/.gitignore@@ -1,2 +1,3 @@playwright-report/test-results/+coverage/diff --git a/frontend/package.json b/frontend/package.jsonindex 2f793e4b5a..8e8d7ecbf9 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -173,6 +173,7 @@"build:watch": "vite build --watch --outDir ../marimo/_static","build": "cross-env vite build","test": "vitest",+ "test:coverage": "vitest run --coverage","typecheck": "tsgo","format": "oxfmt --config ../.oxfmtrc.json","lint": "run-s lint:oxlint lint:stylelint",@@ -211,6 +212,7 @@"@types/react-dom": "^19.2.3","@types/timestring": "^6.0.5","@vitejs/plugin-react": "^5.2.0",+ "@vitest/coverage-v8": "3.2.4","babel-plugin-react-compiler": "19.1.0-rc.3","blob-polyfill": "^7.0.20220408","cross-env": "^7.0.3",diff --git a/frontend/vitest.config.ts b/frontend/vitest.config.tsindex 76e243796d..71c40c0012 100644--- a/frontend/vitest.config.ts+++ b/frontend/vitest.config.ts@@ -10,6 +10,16 @@ export default defineConfig({? ["default", "github-actions"]: ["default"],environment: "jsdom",+ // Coverage is opt-in via `--coverage` (see the `test:coverage` script) so+ // it never slows down the default `pnpm test` run. CI enables it to post a+ // PR comment. `reportOnFailure` keeps the summary available even when tests+ // fail; `json-summary` is what the PR-comment action reads.+ coverage: {+ provider: "v8",+ include: ["src/**"],+ reportOnFailure: true,+ reporter: ["text", "html", "json-summary", "json"],+ },include: ["src/**/*.test.ts", "src/**/*.test.tsx"],setupFiles: ["src/__tests__/setup.ts"],sequence: {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex c95b69c8d5..d7c4a4ce51 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -527,6 +527,9 @@ importers:'@vitejs/plugin-react':specifier: ^5.2.0version: 5.2.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ '@vitest/coverage-v8':+ specifier: 3.2.4+ version: 3.2.4([email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected]))babel-plugin-react-compiler:specifier: 19.1.0-rc.3version: 19.1.0-rc.3@@ -741,6 +744,10 @@ packages:resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==}engines: {node: '>=10'}+ '@ampproject/[email protected]':+ resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}+ engines: {node: '>=6.0.0'}+'@antfu/[email protected]':resolution: {integrity: sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ==}@@ -910,6 +917,10 @@ packages:resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}engines: {node: '>=6.9.0'}+ '@bcoe/[email protected]':+ resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==}+ engines: {node: '>=18'}+'@braintree/[email protected]':resolution: {integrity: sha512-i1L7noDNxtFyL5DmZafWy1wRVhGehQmzZaz1HiN5e7iylJMSZR7ekOV7NsIqa5qBldlLrsKv4HbgFUVlQrz8Mw==}@@ -1514,6 +1525,10 @@ packages:resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}engines: {node: '>=12'}+ '@istanbuljs/[email protected]':+ resolution: {integrity: sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==}+ engines: {node: '>=8'}+'@jest/[email protected]':resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==}engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}@@ -4518,6 +4533,15 @@ packages:peerDependencies:vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0+ '@vitest/[email protected]':+ resolution: {integrity: sha512-EyF9SXU6kS5Ku/U82E259WSnvg6c8KTjppUncuNdm5QHpe17mwREHnjDzozC8x9MZ0xfBUFSaLkRv4TMA75ALQ==}+ peerDependencies:+ '@vitest/browser': 3.2.4+ vitest: 3.2.4+ peerDependenciesMeta:+ '@vitest/browser':+ optional: true+'@vitest/[email protected]':resolution: {integrity: sha512-jXL+9+ZNIJKruofqXuuTClf44eSpcHlgj3CiuNihUF3Ioujtmc0zIa3UJOW5RjDK1YLBJZnWBlPuqhYycLioog==}@@ -4804,6 +4828,9 @@ packages:resolution: {integrity: sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==}engines: {node: '>=4'}+ resolution: {integrity: sha512-BRRC8VRZY2R4Z4lFIL35MwNXmwVqBityvOIwETtsCSwvjl0IdgFsy9NhdaA6j74nUdtJJlIypeRhpDam19Wq3g==}+resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==}engines: {node: '>=8'}@@ -6387,6 +6414,9 @@ packages:resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==}engines: {node: '>=18'}+ resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}+resolution: {integrity: sha512-mSyG0t6CyNI8o8FNy53/XMCzMqtbAmnjv/Qz1AnPgVVeScvCwTA4nQH4ZthYnevjKn+g6vZYco4Nq7m9XrXAFQ==}peerDependencies:@@ -6660,6 +6690,22 @@ packages:resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==}+ resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==}+ engines: {node: '>=8'}++ resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==}+ engines: {node: '>=8'}+resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}@@ -6708,6 +6754,9 @@ packages:resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==}engines: {node: '>=0.10.0'}+ resolution: {integrity: sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==}+resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}@@ -7002,6 +7051,13 @@ packages:resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}+ resolution: {integrity: sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==}++ resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==}+ engines: {node: '>=10'}+resolution: {integrity: sha512-pJpcfLPnIF/Sk3taPW21G/RQsEEirGaFpCW3oXRwH9dnFHPHNGjNyvh++rdmC2fNqEaTw2MhYJraoJWAHx8kEg==}@@ -8889,6 +8945,10 @@ packages:engines: {node: '>=10'}hasBin: true+ resolution: {integrity: sha512-u9E6A+ZDYdp7a4WnarkXPZOx8Ilz46+kby6p1yZ8zsGTz9gYa6FIS7lj2oezzNKmtdyyJNNmmXDppga5GB7kSw==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-d5i6FVvWWPkwrm4cHLI3t9AT1OrkAt7Ig8dtdYSofgF7C/eiyNuq6zQzSTusWTde3jpW9WLvA9J/fzNKMUsd0w==}peerDependencies:@@ -9902,6 +9962,11 @@ snapshots:'@alloc/[email protected]': {}+ '@ampproject/[email protected]':+ dependencies:+ '@jridgewell/gen-mapping': 0.3.13+ '@jridgewell/trace-mapping': 0.3.31+'@antfu/[email protected]':dependencies:package-manager-detector: 1.3.0@@ -10131,6 +10196,8 @@ snapshots:'@babel/helper-string-parser': 7.27.1'@babel/helper-validator-identifier': 7.28.5+ '@bcoe/[email protected]': {}+'@braintree/[email protected]': {}'@bufbuild/[email protected]': {}@@ -10908,6 +10975,8 @@ snapshots:wrap-ansi: 8.1.0wrap-ansi-cjs: [email protected]+ '@istanbuljs/[email protected]': {}+'@jest/[email protected]':dependencies:'@sinclair/typebox': 0.27.8@@ -14415,6 +14484,25 @@ snapshots:transitivePeerDependencies:- supports-color+ '@vitest/[email protected]([email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected]))':+ dependencies:+ '@ampproject/remapping': 2.3.0+ '@bcoe/v8-coverage': 1.0.2+ ast-v8-to-istanbul: 0.3.12+ debug: 4.4.3([email protected])+ istanbul-lib-coverage: 3.2.2+ istanbul-lib-report: 3.0.1+ istanbul-lib-source-maps: 5.0.6+ istanbul-reports: 3.2.0+ magic-string: 0.30.21+ magicast: 0.3.5+ std-env: 3.9.0+ test-exclude: 7.0.2+ tinyrainbow: 2.0.0+ vitest: 3.2.4(@types/[email protected])(@types/[email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])+ transitivePeerDependencies:+ - supports-color+'@vitest/[email protected]':dependencies:'@vitest/spy': 1.6.1@@ -14747,6 +14835,12 @@ snapshots:dependencies:tslib: 2.8.1+ dependencies:+ '@jridgewell/trace-mapping': 0.3.31+ estree-walker: 3.0.3+ js-tokens: 10.0.0+@@ -16554,6 +16648,8 @@ snapshots:dependencies:whatwg-encoding: 3.1.1+ [email protected]: {}+dependencies:domhandler: 5.0.3@@ -16780,6 +16876,27 @@ snapshots:+ [email protected]: {}++ dependencies:+ istanbul-lib-coverage: 3.2.2+ make-dir: 4.0.0+ supports-color: 7.2.0++ dependencies:+ '@jridgewell/trace-mapping': 0.3.31+ debug: 4.4.3([email protected])+ istanbul-lib-coverage: 3.2.2+ transitivePeerDependencies:+ - supports-color++ dependencies:+ html-escaper: 2.0.2+ istanbul-lib-report: 3.0.1+dependencies:'@isaacs/cliui': 8.0.2@@ -16813,6 +16930,8 @@ snapshots:+ [email protected]: {}+@@ -17081,6 +17200,16 @@ snapshots:dependencies:'@jridgewell/sourcemap-codec': 1.5.5+ dependencies:+ '@babel/parser': 7.29.0+ '@babel/types': 7.29.0+ source-map-js: 1.2.1++ dependencies:+ semver: 7.7.4+dependencies:once: 1.3.3@@ -19752,6 +19881,12 @@ snapshots:source-map-support: 0.5.21optional: true+ dependencies:+ '@istanbuljs/schema': 0.1.6+ glob: 10.4.5+ minimatch: 10.2.4+[email protected](@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected]):dependencies:'@codemirror/language': 6.12.3diff --git a/turbo.json b/turbo.jsonindex 142e475136..a6451b4b4c 100644--- a/turbo.json+++ b/turbo.json@@ -12,6 +12,10 @@"test": {"dependsOn": ["build"]},+ "test:coverage": {+ "dependsOn": ["build"],+ "outputs": ["coverage/**"]+ },"codegen": {"cache": false},