Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
457 changes: 415 additions & 42 deletions e2e/plugin-jsdocs-e2e/tests/__snapshots__/collect.e2e.test.ts.snap

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions e2e/plugin-jsdocs-e2e/tests/collect.e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { cp } from 'node:fs/promises';
import path from 'node:path';
import { simpleGit } from 'simple-git';
import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest';
import { type Report, reportSchema } from '@code-pushup/models';
import { nxTargetProject } from '@code-pushup/test-nx-utils';
import {
E2E_ENVIRONMENTS_DIR,
TEST_OUTPUT_DIR,
initGitRepo,
omitVariableReportData,
teardownTestFolder,
} from '@code-pushup/test-utils';
Expand Down Expand Up @@ -34,6 +36,8 @@ describe('PLUGIN collect report with jsdocs-plugin NPM package', () => {
beforeAll(async () => {
await cp(fixturesAngularDir, angularDir, { recursive: true });
await cp(fixturesReactDir, reactDir, { recursive: true });
await initGitRepo(simpleGit, { baseDir: angularDir });
await initGitRepo(simpleGit, { baseDir: reactDir });
});

afterAll(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* An example function which returns a mock value.
* @returns A mock value
*/
export function exampleFunction() {
return 'exampleFunction';
}
1 change: 1 addition & 0 deletions packages/plugin-jsdocs/mocks/node.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function nodeMock(options: {
getJsDocs: () => (options.isCommented ? ['Comment'] : []),
getName: () => 'test',
getStartLineNumber: () => options.line,
getEndLineNumber: () => options.line,
getDeclarations: () => [],
// Only for classes
getMethods: () => [],
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-jsdocs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"outputPath": "dist/packages/plugin-jsdocs",
"main": "packages/plugin-jsdocs/src/index.ts",
"tsConfig": "packages/plugin-jsdocs/tsconfig.lib.json",
"additionalEntryPoints": ["packages/plugin-jsdocs/src/bin.ts"],
"assets": ["packages/plugin-jsdocs/*.md"]
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,115 @@

exports[`getDocumentationReport > should produce a full report 1`] = `
{
"classes": {
"coverage": 33.33,
"issues": [
{
"file": "test.ts",
"line": 4,
"name": "test",
"type": "classes",
},
{
"file": "test.ts",
"line": 5,
"name": "test",
"type": "classes",
},
],
"nodesCount": 3,
},
"enums": {
"coverage": 33.33,
"issues": [
{
"file": "test.ts",
"line": 8,
"name": "test",
"type": "enums",
},
{
"file": "test.ts",
"line": 9,
"name": "test",
"type": "enums",
},
],
"nodesCount": 3,
},
"functions": {
"coverage": 100,
"issues": [],
"nodesCount": 3,
},
"interfaces": {
"coverage": 66.67,
"issues": [
{
"file": "test.ts",
"line": 15,
"name": "test",
"type": "interfaces",
},
],
"nodesCount": 3,
},
"methods": {
"coverage": 100,
"issues": [],
"nodesCount": 0,
},
"properties": {
"coverage": 100,
"issues": [],
"nodesCount": 0,
},
"types": {
"coverage": 50,
"issues": [
{
"file": "test.ts",
"line": 10,
"name": "test",
"type": "types",
},
{
"file": "test.ts",
"line": 11,
"name": "test",
"type": "types",
},
],
"nodesCount": 4,
},
"variables": {
"coverage": 100,
"issues": [],
"nodesCount": 0,
},
"classes": [
{
"covered": 1,
"missing": [
{
"endLine": 4,
"kind": "class",
"name": "test",
"startLine": 4,
},
{
"endLine": 5,
"kind": "class",
"name": "test",
"startLine": 5,
},
],
"path": "test.ts",
"total": 3,
},
],
"enums": [
{
"covered": 1,
"missing": [
{
"endLine": 8,
"kind": "enum",
"name": "test",
"startLine": 8,
},
{
"endLine": 9,
"kind": "enum",
"name": "test",
"startLine": 9,
},
],
"path": "test.ts",
"total": 3,
},
],
"functions": [
{
"covered": 3,
"missing": [],
"path": "test.ts",
"total": 3,
},
],
"interfaces": [
{
"covered": 2,
"missing": [
{
"endLine": 15,
"kind": "interface",
"name": "test",
"startLine": 15,
},
],
"path": "test.ts",
"total": 3,
},
],
"methods": [
{
"covered": 0,
"missing": [],
"path": "test.ts",
"total": 0,
},
],
"properties": [
{
"covered": 0,
"missing": [],
"path": "test.ts",
"total": 0,
},
],
"types": [
{
"covered": 2,
"missing": [
{
"endLine": 10,
"kind": "type",
"name": "test",
"startLine": 10,
},
{
"endLine": 11,
"kind": "type",
"name": "test",
"startLine": 11,
},
],
"path": "test.ts",
"total": 4,
},
],
"variables": [
{
"covered": 0,
"missing": [],
"path": "test.ts",
"total": 0,
},
],
}
`;
Loading
Loading