From 7ab0ef494137276226f1dd24b4bc5dd7f35861f1 Mon Sep 17 00:00:00 2001 From: Mike Bender Date: Wed, 24 Nov 2021 15:32:59 -0500 Subject: [PATCH 1/4] WIP enabling coverage tests in github actions --- .github/workflows/node.js.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 63a1030edb..0db10c7f4f 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -74,7 +74,7 @@ jobs: - name: Test (Pull Request) if: ${{ github.event_name == 'pull_request' }} run: | - npm run test:ci -- --changedSince origin/${{ github.event.pull_request.base.ref }} + npm run test:ci -- --changedSince origin/${{ github.event.pull_request.base.ref }} --collectCoverage=true npm run test:golden-layout - name: Test (Push) @@ -82,3 +82,10 @@ jobs: run: | npm run test:ci -- --lastCommit npm run test:golden-layout + + - name: Codecov report + uses: codecov/codecov-action@v2 + if: ${{ github.event_name == 'pull_request' }} + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unit From 7dfff1aee8b2ebe4f1994596a251d7ad80efedba Mon Sep 17 00:00:00 2001 From: Mike Bender Date: Wed, 24 Nov 2021 16:16:46 -0500 Subject: [PATCH 2/4] Create codecov.yml, add badge to readme --- README.md | 2 ++ codecov.yml | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 codecov.yml diff --git a/README.md b/README.md index 817eb1e8aa..701a84ea02 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ We're using a monorepo to manage our packages, as it becomes cumbersome to manage the overhead of multiple repos with how we wish to develop the Enterprise UI, while maintaining a separate OSS Code Studio solution. Using `lerna` to manage all of our packages in one repo simplifies the process. +[![codecov](https://codecov.io/gh/deephaven/web-client-ui/branch/main/graph/badge.svg?token=RW29S9X72C)](https://codecov.io/gh/deephaven/web-client-ui) + ## Getting Started We are still using node 14.x and npm 6.x. If you are [using nvm](https://github.com/nvm-sh/nvm#installing-and-updating), run `nvm install lts/fermium` to get the latest 14.x/6.x versions. Otherwise, download from the [node homepage](https://nodejs.org/en/download/). diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..5679b86fd7 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,3 @@ +flags: + unit: + carryforward: true From 755ddeb1cc91769106e9ef9beab6e508f45962c6 Mon Sep 17 00:00:00 2001 From: Mike Bender Date: Wed, 24 Nov 2021 16:54:09 -0500 Subject: [PATCH 3/4] Remove coverageThresholds They'll be set in codecov if necessary --- jest.config.cjs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index 520e5a5512..427853f857 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -22,16 +22,4 @@ module.exports = { ], collectCoverage: false, collectCoverageFrom: ['./src/**/*.{js,ts,jsx,tsx}'], // This is relative to individual project root due to how Jest handles it - coverageThreshold: { - // These global thresholds were taken as the baseline of the overall project when code coverage initiative began. - // In CI, these thresholds will be measures against only the files you have changed. - // We may want to increase/decrease the thresholds for specific projects, and we can do that: - // https://jestjs.io/docs/configuration#coveragethreshold-object - global: { - statements: 40, - branches: 30, - functions: 30, - lines: 40, - }, - }, }; From c9fd09e2e1e51c0246d062b87494ae3db6c9e44b Mon Sep 17 00:00:00 2001 From: mikebender Date: Thu, 25 Nov 2021 09:49:45 -0500 Subject: [PATCH 4/4] Add a test file for FileExistsError Going to test out how this works... --- .../file-explorer/src/FileExistsError.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 packages/file-explorer/src/FileExistsError.test.ts diff --git a/packages/file-explorer/src/FileExistsError.test.ts b/packages/file-explorer/src/FileExistsError.test.ts new file mode 100644 index 0000000000..6cf65c8307 --- /dev/null +++ b/packages/file-explorer/src/FileExistsError.test.ts @@ -0,0 +1,16 @@ +import { FileStorageItem } from './FileStorage'; +import FileExistsError from './FileExistsError'; + +it('creates the error correct', () => { + const file: FileStorageItem = { + type: 'file', + basename: 'basename', + filename: '/dir/basename', + id: '/dir/basename', + }; + const error = new FileExistsError(file); + expect(error.info).toBe(file); + expect(error.isExistingFile).toBe(true); + expect(error.isInvalid).toBe(true); + expect(error.message).toEqual('Name already exists'); +});