From 728776b3e69d2370f235629a4ef68032af2fd100 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Fri, 29 Dec 2023 07:24:34 +0100 Subject: [PATCH] ci: upload test coverage results (#298) Also rename the artifact storing all examples for clarity. --- .github/workflows/build.yml | 9 +++++++-- .gitignore | 19 +++++++------------ packages/core/jest.config.cjs | 2 ++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be007d608..b58e26595 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,12 @@ jobs: - name: Build @maxgraph/core - esm run: npm run build -w packages/core - name: Test @maxgraph/core - run: npm test -w packages/core + run: npm test -w packages/core -- --coverage + - name: Upload test results as artifact + uses: actions/upload-artifact@v4 + with: + name: test-coverage-${{runner.os}}-${{github.sha}} + path: packages/core/coverage/lcov-report - name: Test TypeScript support run: npm test -w packages/ts-support - name: Build ts-example @@ -55,7 +60,7 @@ jobs: - name: Upload all examples as artifact uses: actions/upload-artifact@v4 with: - name: bundles-test-results-${{runner.os}}-${{github.sha}} + name: examples-${{runner.os}}-${{github.sha}} path: | packages/html/dist/ packages/ts-example/dist/ diff --git a/.gitignore b/.gitignore index 194c00a58..b7ac673d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,17 @@ -node_modules -javascript/dist .jshintrc -javascript/examples/**/dist .idea/ -.vscode/ *.iml +.vscode/ dist *.tgz # dependencies -/node_modules +node_modules/ /.pnp .pnp.js # testing -/coverage - -# next.js -/.next/ -/out/ +coverage/ # production build/ @@ -38,6 +31,8 @@ yarn-error.log* .env.test.local .env.production.local -# vercel +# vercel/next.js +.next/ .vercel -/src/.next/ +src/.next/ +out/ diff --git a/packages/core/jest.config.cjs b/packages/core/jest.config.cjs index bf6709141..1799359bb 100644 --- a/packages/core/jest.config.cjs +++ b/packages/core/jest.config.cjs @@ -1,5 +1,7 @@ /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { + collectCoverageFrom: ['src/**/*.{ts,js}'], + coverageReporters: ['lcov', 'text-summary'], // preset: 'ts-jest', preset: 'ts-jest/presets/default-esm', testEnvironment: 'jsdom', // need to access to the browser objects