-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
666 additions
and
518 deletions.
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 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 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 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 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 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 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 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 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 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 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.