Skip to content

Commit f010d73

Browse files
committed
test(plugin-typescript-e2e): include audit outputs in assertion
1 parent 253ff48 commit f010d73

File tree

2 files changed

+93
-4
lines changed

2 files changed

+93
-4
lines changed

e2e/plugin-typescript-e2e/tests/__snapshots__/typescript-plugin-json-report.json renamed to e2e/plugin-typescript-e2e/tests/__snapshots__/collect.e2e.test.ts.snap

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`PLUGIN collect report with typescript-plugin NPM package > should run plugin over CLI and creates report.json 1`] = `
14
{
25
"categories": [
36
{
@@ -31,38 +34,125 @@
3134
"audits": [
3235
{
3336
"description": "Errors that occur during parsing and lexing of TypeScript source code",
37+
"details": {
38+
"issues": [
39+
{
40+
"message": "TS1136: Property assignment expected.",
41+
"severity": "error",
42+
"source": {
43+
"file": "tmp/e2e/plugin-typescript-e2e/src/1-syntax-errors.ts",
44+
"position": {
45+
"startLine": 1,
46+
},
47+
},
48+
},
49+
],
50+
},
51+
"displayValue": "1 issue",
52+
"score": 0,
3453
"slug": "syntax-errors",
3554
"title": "Syntax errors",
55+
"value": 1,
3656
},
3757
{
3858
"description": "Errors that occur during type checking and type inference",
59+
"details": {
60+
"issues": [
61+
{
62+
"message": "TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.",
63+
"severity": "error",
64+
"source": {
65+
"file": "tmp/e2e/plugin-typescript-e2e/src/2-semantic-errors.ts",
66+
"position": {
67+
"startLine": 3,
68+
},
69+
},
70+
},
71+
{
72+
"message": "TS2322: Type 'null' is not assignable to type 'string'.",
73+
"severity": "error",
74+
"source": {
75+
"file": "tmp/e2e/plugin-typescript-e2e/src/2-semantic-errors.ts",
76+
"position": {
77+
"startLine": 7,
78+
},
79+
},
80+
},
81+
],
82+
},
83+
"displayValue": "2 issues",
84+
"score": 0,
3985
"slug": "semantic-errors",
4086
"title": "Semantic errors",
87+
"value": 2,
4188
},
4289
{
4390
"description": "Errors that occur during TypeScript language service operations",
91+
"details": {
92+
"issues": [
93+
{
94+
"message": "TS4112: This member cannot have an 'override' modifier because its containing class 'Standalone' does not extend another class.",
95+
"severity": "error",
96+
"source": {
97+
"file": "tmp/e2e/plugin-typescript-e2e/src/4-languale-service.ts",
98+
"position": {
99+
"startLine": 2,
100+
},
101+
},
102+
},
103+
],
104+
},
105+
"displayValue": "1 issue",
106+
"score": 0,
44107
"slug": "declaration-and-language-service-errors",
45108
"title": "Declaration and language service errors",
109+
"value": 1,
46110
},
47111
{
48112
"description": "Errors that occur during TypeScript internal operations",
113+
"displayValue": "0 issues",
114+
"score": 1,
49115
"slug": "internal-errors",
50116
"title": "Internal errors",
117+
"value": 0,
51118
},
52119
{
53120
"description": "Errors that occur when parsing TypeScript configuration files",
121+
"details": {
122+
"issues": [
123+
{
124+
"message": "TS6059: File '/home/matejchalk/Projects/quality-metrics-cli/tmp/e2e/plugin-typescript-e2e/exclude/utils.ts' is not under 'rootDir' 'src'. 'rootDir' is expected to contain all source files.",
125+
"severity": "error",
126+
"source": {
127+
"file": "tmp/e2e/plugin-typescript-e2e/src/6-configuration-errors.ts",
128+
"position": {
129+
"startLine": 1,
130+
},
131+
},
132+
},
133+
],
134+
},
135+
"displayValue": "1 issue",
136+
"score": 0,
54137
"slug": "configuration-errors",
55138
"title": "Configuration errors",
139+
"value": 1,
56140
},
57141
{
58142
"description": "Errors related to no implicit any compiler option",
143+
"displayValue": "0 issues",
144+
"score": 1,
59145
"slug": "no-implicit-any-errors",
60146
"title": "No implicit any errors",
147+
"value": 0,
61148
},
62149
{
63150
"description": "Errors that do not match any known TypeScript error code",
151+
"displayValue": "0 issues",
152+
"score": 1,
64153
"slug": "unknown-codes",
65154
"title": "Unknown codes",
155+
"value": 0,
66156
},
67157
],
68158
"description": "Official Code PushUp Typescript plugin.",
@@ -124,4 +214,5 @@
124214
"title": "Typescript",
125215
},
126216
],
127-
}
217+
}
218+
`;

e2e/plugin-typescript-e2e/tests/collect.e2e.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ describe('PLUGIN collect report with typescript-plugin NPM package', () => {
6868
path.join(envRoot, outputDir, 'report.json'),
6969
);
7070
expect(() => reportSchema.parse(reportJson)).not.toThrow();
71-
expect(
72-
omitVariableReportData(reportJson, { omitAuditData: true }),
73-
).toMatchFileSnapshot('__snapshots__/typescript-plugin-json-report.json');
71+
expect(omitVariableReportData(reportJson)).toMatchSnapshot();
7472
});
7573
});

0 commit comments

Comments
 (0)