-
Notifications
You must be signed in to change notification settings - Fork 15
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
15 changed files
with
456 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
import tseslint from 'typescript-eslint'; | ||
import baseConfig from '../../eslint.config.js'; | ||
|
||
export default tseslint.config(...baseConfig, { | ||
files: ['**/*.ts'], | ||
languageOptions: { | ||
parserOptions: { | ||
projectService: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}); |
5 changes: 5 additions & 0 deletions
5
e2e/plugin-doc-coverage-e2e/mocks/fixtures/angular/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,5 @@ | ||
import docCoveragePlugin from '@code-pushup/doc-coverage-plugin'; | ||
|
||
export default { | ||
plugins: [await docCoveragePlugin({ sourceGlob: ['**/*.ts'] })], | ||
}; |
4 changes: 4 additions & 0 deletions
4
e2e/plugin-doc-coverage-e2e/mocks/fixtures/angular/src/app.component.css
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,4 @@ | ||
h1 { | ||
color: #336699; | ||
text-align: center; | ||
} |
1 change: 1 addition & 0 deletions
1
e2e/plugin-doc-coverage-e2e/mocks/fixtures/angular/src/app.component.html
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 @@ | ||
<h1>{{ title }}</h1> |
3 changes: 3 additions & 0 deletions
3
e2e/plugin-doc-coverage-e2e/mocks/fixtures/angular/src/app.component.spec.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,3 @@ | ||
function notRealisticFunction() { | ||
return 'notRealisticFunction'; | ||
} |
18 changes: 18 additions & 0 deletions
18
e2e/plugin-doc-coverage-e2e/mocks/fixtures/angular/src/app.component.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,18 @@ | ||
/** | ||
* Basic Angular component that displays a welcome message | ||
*/ | ||
export class AppComponent { | ||
protected readonly title = 'My Angular App'; | ||
|
||
/** | ||
* Dummy method that returns a welcome message | ||
* @returns {string} - The welcome message | ||
*/ | ||
getWelcomeMessage() { | ||
return 'Welcome to My Angular App!'; | ||
} | ||
|
||
sendEvent() { | ||
return 'Event sent'; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
e2e/plugin-doc-coverage-e2e/mocks/fixtures/angular/src/map-event.function.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,10 @@ | ||
export const someVariable = 'Hello World 1'; | ||
|
||
export function mapEventToCustomEvent(event: string) { | ||
return event; | ||
} | ||
|
||
/** Commented */ | ||
export function mapCustomEventToEvent(event: string) { | ||
return event; | ||
} |
5 changes: 5 additions & 0 deletions
5
e2e/plugin-doc-coverage-e2e/mocks/fixtures/react/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,5 @@ | ||
import docCoveragePlugin from '@code-pushup/doc-coverage-plugin'; | ||
|
||
export default { | ||
plugins: [await docCoveragePlugin({ sourceGlob: ['**/*.ts'] })], | ||
}; |
10 changes: 10 additions & 0 deletions
10
e2e/plugin-doc-coverage-e2e/mocks/fixtures/react/component.js
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,10 @@ | ||
function MyComponent() { | ||
return ( | ||
<div> | ||
<h1>Hello World</h1> | ||
<p>This is a basic React component</p> | ||
</div> | ||
); | ||
} | ||
|
||
export default MyComponent; |
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-doc-coverage-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "e2e/plugin-doc-coverage-e2e/src", | ||
"projectType": "application", | ||
"targets": { | ||
"lint": { | ||
"executor": "@nx/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["e2e/plugin-doc-coverage-e2e/**/*.ts"] | ||
} | ||
}, | ||
"e2e": { | ||
"executor": "@nx/vite:test", | ||
"options": { | ||
"configFile": "e2e/plugin-doc-coverage-e2e/vite.config.e2e.ts" | ||
} | ||
} | ||
}, | ||
"implicitDependencies": ["cli", "plugin-doc-coverage"], | ||
"tags": ["scope:plugin", "type:e2e"] | ||
} |
227 changes: 227 additions & 0 deletions
227
e2e/plugin-doc-coverage-e2e/tests/__snapshots__/collect.e2e.test.ts.snap
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,227 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`PLUGIN collect report with eslint-plugin NPM package > should run ESLint plugin for flat config and create report.json 1`] = ` | ||
{ | ||
"packageName": "@code-pushup/core", | ||
"plugins": [ | ||
{ | ||
"audits": [ | ||
{ | ||
"description": "ESLint rule **eqeqeq**.", | ||
"details": { | ||
"issues": [ | ||
{ | ||
"message": "Expected '===' and instead saw '=='.", | ||
"severity": "error", | ||
"source": { | ||
"file": "tmp/e2e/plugin-doc-coverage-e2e/__test__/flat-config/src/index.js", | ||
"position": { | ||
"endColumn": 15, | ||
"endLine": 6, | ||
"startColumn": 13, | ||
"startLine": 6, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
"displayValue": "1 error", | ||
"docsUrl": "https://eslint.org/docs/latest/rules/eqeqeq", | ||
"score": 0, | ||
"slug": "eqeqeq", | ||
"title": "Require the use of \`===\` and \`!==\`", | ||
"value": 1, | ||
}, | ||
{ | ||
"description": "ESLint rule **max-lines**. | ||
Custom options: | ||
\`\`\`json | ||
100 | ||
\`\`\`", | ||
"details": { | ||
"issues": [], | ||
}, | ||
"displayValue": "passed", | ||
"docsUrl": "https://eslint.org/docs/latest/rules/max-lines", | ||
"score": 1, | ||
"slug": "max-lines-71b54366cb01f77b", | ||
"title": "Enforce a maximum number of lines per file", | ||
"value": 0, | ||
}, | ||
{ | ||
"description": "ESLint rule **no-unused-vars**.", | ||
"details": { | ||
"issues": [ | ||
{ | ||
"message": "'unusedFn' is defined but never used.", | ||
"severity": "warning", | ||
"source": { | ||
"file": "tmp/e2e/plugin-doc-coverage-e2e/__test__/flat-config/src/index.js", | ||
"position": { | ||
"endColumn": 18, | ||
"endLine": 1, | ||
"startColumn": 10, | ||
"startLine": 1, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
"displayValue": "1 warning", | ||
"docsUrl": "https://eslint.org/docs/latest/rules/no-unused-vars", | ||
"score": 0, | ||
"slug": "no-unused-vars", | ||
"title": "Disallow unused variables", | ||
"value": 1, | ||
}, | ||
], | ||
"description": "Official Code PushUp ESLint plugin", | ||
"docsUrl": "https://www.npmjs.com/package/@code-pushup/eslint-plugin", | ||
"groups": [ | ||
{ | ||
"description": "Code that either will cause an error or may cause confusing behavior. Developers should consider this a high priority to resolve.", | ||
"refs": [ | ||
{ | ||
"slug": "no-unused-vars", | ||
"weight": 1, | ||
}, | ||
], | ||
"slug": "problems", | ||
"title": "Problems", | ||
}, | ||
{ | ||
"description": "Something that could be done in a better way but no errors will occur if the code isn't changed.", | ||
"refs": [ | ||
{ | ||
"slug": "eqeqeq", | ||
"weight": 1, | ||
}, | ||
{ | ||
"slug": "max-lines-71b54366cb01f77b", | ||
"weight": 1, | ||
}, | ||
], | ||
"slug": "suggestions", | ||
"title": "Suggestions", | ||
}, | ||
], | ||
"icon": "eslint", | ||
"packageName": "@code-pushup/eslint-plugin", | ||
"slug": "eslint", | ||
"title": "ESLint", | ||
}, | ||
], | ||
} | ||
`; | ||
exports[`PLUGIN collect report with eslint-plugin NPM package > should run ESLint plugin for legacy config and create report.json 1`] = ` | ||
{ | ||
"packageName": "@code-pushup/core", | ||
"plugins": [ | ||
{ | ||
"audits": [ | ||
{ | ||
"description": "ESLint rule **no-unused-vars**.", | ||
"details": { | ||
"issues": [ | ||
{ | ||
"message": "'unusedFn' is defined but never used.", | ||
"severity": "error", | ||
"source": { | ||
"file": "tmp/e2e/plugin-doc-coverage-e2e/__test__/legacy-config/src/index.js", | ||
"position": { | ||
"endColumn": 18, | ||
"endLine": 1, | ||
"startColumn": 10, | ||
"startLine": 1, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
"displayValue": "1 error", | ||
"docsUrl": "https://eslint.org/docs/latest/rules/no-unused-vars", | ||
"score": 0, | ||
"slug": "no-unused-vars", | ||
"title": "Disallow unused variables", | ||
"value": 1, | ||
}, | ||
{ | ||
"description": "ESLint rule **no-console**.", | ||
"details": { | ||
"issues": [ | ||
{ | ||
"message": "Unexpected console statement.", | ||
"severity": "warning", | ||
"source": { | ||
"file": "tmp/e2e/plugin-doc-coverage-e2e/__test__/legacy-config/src/index.js", | ||
"position": { | ||
"endColumn": 14, | ||
"endLine": 5, | ||
"startColumn": 3, | ||
"startLine": 5, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
"displayValue": "1 warning", | ||
"docsUrl": "https://eslint.org/docs/latest/rules/no-console", | ||
"score": 0, | ||
"slug": "no-console", | ||
"title": "Disallow the use of \`console\`", | ||
"value": 1, | ||
}, | ||
{ | ||
"description": "ESLint rule **no-undef**.", | ||
"details": { | ||
"issues": [], | ||
}, | ||
"displayValue": "passed", | ||
"docsUrl": "https://eslint.org/docs/latest/rules/no-undef", | ||
"score": 1, | ||
"slug": "no-undef", | ||
"title": "Disallow the use of undeclared variables unless mentioned in \`/*global */\` comments", | ||
"value": 0, | ||
}, | ||
], | ||
"description": "Official Code PushUp ESLint plugin", | ||
"docsUrl": "https://www.npmjs.com/package/@code-pushup/eslint-plugin", | ||
"groups": [ | ||
{ | ||
"description": "Code that either will cause an error or may cause confusing behavior. Developers should consider this a high priority to resolve.", | ||
"refs": [ | ||
{ | ||
"slug": "no-unused-vars", | ||
"weight": 1, | ||
}, | ||
{ | ||
"slug": "no-undef", | ||
"weight": 1, | ||
}, | ||
], | ||
"slug": "problems", | ||
"title": "Problems", | ||
}, | ||
{ | ||
"description": "Something that could be done in a better way but no errors will occur if the code isn't changed.", | ||
"refs": [ | ||
{ | ||
"slug": "no-console", | ||
"weight": 1, | ||
}, | ||
], | ||
"slug": "suggestions", | ||
"title": "Suggestions", | ||
}, | ||
], | ||
"icon": "eslint", | ||
"packageName": "@code-pushup/eslint-plugin", | ||
"slug": "eslint", | ||
"title": "ESLint", | ||
}, | ||
], | ||
} | ||
`; |
Oops, something went wrong.