-
Notifications
You must be signed in to change notification settings - Fork 15
test: split coverage e2e #872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7dad5b5
test: split coverage tests
BioPhoton e8cba86
config
BioPhoton 69eba25
polish
BioPhoton ff44111
polish
BioPhoton 9ddce4d
remove duplicate CP runs
BioPhoton 3239423
add test script
BioPhoton 3ad8ee4
verbose gh action
BioPhoton a624b5a
adjust tests
BioPhoton c32e158
cleanup
BioPhoton ded72c0
refactor e2e env setup
BioPhoton cb4e0f9
cleanup env setup
BioPhoton 22a6908
fix snapshots
BioPhoton 0a477cb
remove check for warning and error
BioPhoton 1b066e0
Update .github/workflows/ci.yml
BioPhoton d165ddd
Update .github/workflows/ci.yml
BioPhoton 127608e
Update e2e/plugin-coverage-e2e/tests/collect.e2e.test.ts
BioPhoton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
420 changes: 0 additions & 420 deletions
420
e2e/cli-e2e/tests/__snapshots__/collect.e2e.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "extends": ["../../.eslintrc.json"], | ||
| "ignorePatterns": ["!**/*", "code-pushup.config*.ts"], | ||
| "overrides": [ | ||
| { | ||
| "files": ["*.ts", "*.tsx"], | ||
| "parserOptions": { | ||
| "project": ["e2e/plugin-coverage-e2e/tsconfig.*?.json"] | ||
| } | ||
| } | ||
| ] | ||
| } |
27 changes: 27 additions & 0 deletions
27
e2e/plugin-coverage-e2e/mocks/fixtures/basic-setup/code-pushup.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import coveragePlugin from '@code-pushup/coverage-plugin'; | ||
|
|
||
| export default { | ||
| plugins: [ | ||
| await coveragePlugin({ | ||
| reports: ['coverage/lcov.info'], | ||
| coverageToolCommand: { | ||
| command: 'npm', | ||
| args: ['run', 'test'], | ||
| }, | ||
| }), | ||
| ], | ||
| categories: [ | ||
| { | ||
| slug: 'code-coverage', | ||
| title: 'Code coverage', | ||
| refs: [ | ||
| { | ||
| type: 'group', | ||
| plugin: 'coverage', | ||
| slug: 'coverage', | ||
| weight: 1, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }; |
14 changes: 14 additions & 0 deletions
14
e2e/plugin-coverage-e2e/mocks/fixtures/basic-setup/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "name": "coverage-e2e-env", | ||
| "version": "1.0.0", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "test": "npx vitest run --coverage" | ||
| }, | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| }, | ||
| "description": "" | ||
| } |
15 changes: 15 additions & 0 deletions
15
e2e/plugin-coverage-e2e/mocks/fixtures/basic-setup/src/index.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| export function untested() { | ||
| console.log('This function is not tested'); | ||
| } | ||
|
|
||
| export function get42() { | ||
| return 42; | ||
| } | ||
|
|
||
| export function isEven(num) { | ||
| if (num === undefined) { | ||
| return false; | ||
| } | ||
| const parsedNumber = parseInt(num, 10); | ||
| return parsedNumber % 2 === 0; | ||
| } |
18 changes: 18 additions & 0 deletions
18
e2e/plugin-coverage-e2e/mocks/fixtures/basic-setup/src/index.test.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { get42, isEven, untested } from './index.mjs'; | ||
|
|
||
| describe('get42', () => { | ||
| it('should return 42', async () => { | ||
| expect(get42()).toBe(42); | ||
| }); | ||
| }); | ||
|
|
||
| describe('isEven', () => { | ||
| it('should return true for even number 42', async () => { | ||
| expect(isEven(42)).toBe(true); | ||
| }); | ||
|
|
||
| it.todo('should return false for odd number 1'); | ||
| }); | ||
|
|
||
| describe.todo('untested', () => {}); |
25 changes: 25 additions & 0 deletions
25
e2e/plugin-coverage-e2e/mocks/fixtures/basic-setup/vite.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /// <reference types="vitest" /> | ||
| import { dirname } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { defineConfig } from 'vite'; | ||
|
|
||
| export default defineConfig({ | ||
| root: fileURLToPath(dirname(import.meta.url)), | ||
| cacheDir: 'node_modules/.vite/coverage-e2e-env', | ||
|
|
||
| test: { | ||
| reporters: ['basic'], | ||
| globals: true, | ||
| cache: { | ||
| dir: 'node_modules/.vitest', | ||
| }, | ||
| coverage: { | ||
| reporter: ['lcov', 'text'], | ||
| provider: 'v8', | ||
| reportsDirectory: 'coverage', | ||
| include: ['src/**/*.{js,mjs}'], | ||
| }, | ||
| environment: 'node', | ||
| include: ['src/**/*.{test,spec}.{js,mjs}'], | ||
| }, | ||
| }); |
25 changes: 25 additions & 0 deletions
25
e2e/plugin-coverage-e2e/mocks/fixtures/existing-report/code-pushup.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { join } from 'node:path'; | ||
| import coveragePlugin from '@code-pushup/coverage-plugin'; | ||
| import type { CoreConfig } from '@code-pushup/models'; | ||
|
|
||
| export default { | ||
| plugins: [ | ||
| await coveragePlugin({ | ||
| reports: [join('coverage', 'lcov.info')], | ||
| }), | ||
| ], | ||
| categories: [ | ||
| { | ||
| slug: 'code-coverage', | ||
| title: 'Code coverage', | ||
| refs: [ | ||
| { | ||
| type: 'group', | ||
| plugin: 'coverage', | ||
| slug: 'coverage', | ||
| weight: 1, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| } satisfies CoreConfig; |
78 changes: 78 additions & 0 deletions
78
e2e/plugin-coverage-e2e/mocks/fixtures/existing-report/coverage/lcov.info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| TN: | ||
| SF:src\lib\partly-covered\utils.ts | ||
| FN:2,formatReportScore | ||
| FN:6,calcDuration | ||
| FNF:2 | ||
| FNH:1 | ||
| FNDA:0,formatReportScore | ||
| FNDA:6,calcDuration | ||
| DA:1,1 | ||
| DA:2,1 | ||
| DA:3,1 | ||
| DA:4,1 | ||
| DA:5,1 | ||
| DA:6,1 | ||
| DA:7,0 | ||
| DA:8,0 | ||
| DA:9,0 | ||
| DA:10,1 | ||
| LF:10 | ||
| LH:7 | ||
| BRDA:1,0,0,6 | ||
| BRDA:1,1,0,5 | ||
| BRDA:2,4,0,1 | ||
| BRDA:4,5,0,17 | ||
| BRDA:5,6,0,4 | ||
| BRDA:6,7,0,13 | ||
| BRDA:6,10,1,0 | ||
| BRDA:7,11,0,3 | ||
| BRDA:10,12,0,12 | ||
| BRDA:10,13,1,0 | ||
| BRF:10 | ||
| BRH:8 | ||
| end_of_record | ||
| SF:src\lib\not-covered\sorting.ts | ||
| FN:1,sortReport | ||
| FNF:1 | ||
| FNH:0 | ||
| FNDA:0,sortReport | ||
| DA:1,0 | ||
| DA:2,0 | ||
| DA:3,0 | ||
| DA:4,0 | ||
| DA:5,0 | ||
| LF:5 | ||
| LH:0 | ||
| BRDA:7,1,0,0 | ||
| BRDA:7,2,1,0 | ||
| BRF:2 | ||
| BRH:0 | ||
| end_of_record | ||
| TN: | ||
| SF:src\lib\fully-covered\scoring.ts | ||
| FN:2,scoreReport | ||
| FN:8,calculateScore | ||
| FNF:2 | ||
| FNH:2 | ||
| FNDA:3,scoreReport | ||
| FNDA:5,calculateScore | ||
| DA:1,1 | ||
| DA:2,1 | ||
| DA:3,1 | ||
| DA:4,1 | ||
| DA:5,1 | ||
| DA:6,1 | ||
| DA:7,1 | ||
| DA:8,1 | ||
| DA:9,1 | ||
| DA:10,1 | ||
| LF:10 | ||
| LH:10 | ||
| BRDA:1,0,0,5 | ||
| BRDA:2,1,0,1 | ||
| BRDA:2,2,1,4 | ||
| BRDA:2,3,2,3 | ||
| BRDA:6,4,0,4 | ||
| BRF:5 | ||
| BRH:5 | ||
| end_of_record |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "name": "plugin-coverage-e2e", | ||
| "$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
| "sourceRoot": "e2e/plugin-coverage-e2e/src", | ||
| "projectType": "application", | ||
| "targets": { | ||
| "lint": { | ||
| "executor": "@nx/linter:eslint", | ||
| "outputs": ["{options.outputFile}"], | ||
| "options": { | ||
| "lintFilePatterns": ["e2e/plugin-coverage-e2e/**/*.ts"] | ||
| } | ||
| }, | ||
| "e2e": { | ||
| "executor": "@nx/vite:test", | ||
| "options": { | ||
| "configFile": "e2e/plugin-coverage-e2e/vite.config.e2e.ts" | ||
| } | ||
| } | ||
| }, | ||
| "implicitDependencies": ["cli", "plugin-coverage"], | ||
| "tags": ["scope:plugin", "type:e2e"] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.