From edb6a47028781d232cdf6d62fdcfa18866ff95a7 Mon Sep 17 00:00:00 2001 From: kruplm <73655443+kruplm@users.noreply.github.com> Date: Thu, 9 Mar 2023 11:23:12 +0100 Subject: [PATCH] Add codecov to CI (#169) * Add codecov to CI * Coverage for .NET * Generate coverage to composeui-messaging-client * set target to 100% --- .../continuous-integration-prototypes.yml | 7 +++- Tryouts/Messaging-JS/.gitignore | 1 + Tryouts/Messaging-JS/jest.config.ts | 25 +++++++++++ Tryouts/Messaging-JS/package.json | 41 ------------------- codecov.yml | 6 ++- 5 files changed, 35 insertions(+), 45 deletions(-) create mode 100644 Tryouts/Messaging-JS/jest.config.ts diff --git a/.github/workflows/continuous-integration-prototypes.yml b/.github/workflows/continuous-integration-prototypes.yml index 61a0581ea..d787d907d 100644 --- a/.github/workflows/continuous-integration-prototypes.yml +++ b/.github/workflows/continuous-integration-prototypes.yml @@ -31,7 +31,7 @@ jobs: run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet build $_ --configuration Release --no-restore; if ($LASTEXITCODE -ne 0 ) {throw "Build for $_ FAILED"; }} - name: Test .Net - run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet test $_ --no-restore --verbosity normal} + run: Get-ChildItem -Recurse -Include *.sln | ForEach-Object {dotnet test $_ --no-restore --verbosity normal --collect:"XPlat Code Coverage"} - name: Setup Node.js ${{ matrix.node-version }} @@ -45,4 +45,7 @@ jobs: run: npx lerna run build - name: Test JavaScript - run: npx lerna run test \ No newline at end of file + run: npx lerna run test + + - name: Codecov + uses: codecov/codecov-action@v3.0.0 \ No newline at end of file diff --git a/Tryouts/Messaging-JS/.gitignore b/Tryouts/Messaging-JS/.gitignore index 1eae0cf67..64f046d19 100644 --- a/Tryouts/Messaging-JS/.gitignore +++ b/Tryouts/Messaging-JS/.gitignore @@ -1,2 +1,3 @@ dist/ node_modules/ +coverage/ \ No newline at end of file diff --git a/Tryouts/Messaging-JS/jest.config.ts b/Tryouts/Messaging-JS/jest.config.ts new file mode 100644 index 000000000..45d08464e --- /dev/null +++ b/Tryouts/Messaging-JS/jest.config.ts @@ -0,0 +1,25 @@ +/* + * For a detailed explanation regarding each configuration property and type check, visit: + * https://jestjs.io/docs/configuration + */ + +export default { + // Automatically clear mock calls, instances, contexts and results before every test + clearMocks: true, + + // Indicates whether the coverage information should be collected while executing the test + collectCoverage: true, + + // The directory where Jest should output its coverage files + coverageDirectory: "coverage", + + // Indicates which provider should be used to instrument code for coverage + coverageProvider: "v8", + + // A preset that is used as a base for Jest's configuration + preset: "ts-jest/presets/default-esm", + setupFilesAfterEnv: [ + "./testSetup.ts" + ] +}; + diff --git a/Tryouts/Messaging-JS/package.json b/Tryouts/Messaging-JS/package.json index 875d69e14..94965e6bd 100644 --- a/Tryouts/Messaging-JS/package.json +++ b/Tryouts/Messaging-JS/package.json @@ -36,46 +36,5 @@ "dependencies": { "@types/node": "^18.11.18", "rxjs": "^7.8.0" - }, - "jest": { - "preset": "ts-jest/presets/default-esm", - "setupFilesAfterEnv": [ - "./testSetup.ts" - ] - }, - "dependenciesMeta": { - "@jest/expect-utils@29.4.1": { - "unplugged": true - }, - "@rollup/plugin-typescript@11.0.0": { - "unplugged": true - }, - "@types/jest@29.4.0": { - "unplugged": true - }, - "expect@29.4.1": { - "unplugged": true - }, - "jest@29.4.1": { - "unplugged": true - }, - "jest-extended@3.2.3": { - "unplugged": true - }, - "rollup@3.17.2": { - "unplugged": true - }, - "rollup-plugin-dts@5.2.0": { - "unplugged": true - }, - "rollup-plugin-esbuild@5.0.0": { - "unplugged": true - }, - "ts-jest@29.0.5": { - "unplugged": true - }, - "typescript@4.9.5": { - "unplugged": true - } } } diff --git a/codecov.yml b/codecov.yml index 5a9fd2f8c..36ba848de 100644 --- a/codecov.yml +++ b/codecov.yml @@ -7,8 +7,10 @@ coverage: status: project: yes - patch: no + patch: + default: + target: 100% changes: no comment: - layout: "diff, flags, files" + layout: "reach, diff, flags, files"