Skip to content

Commit 3444e8d

Browse files
committed
feat(plugin-jsdocs): update to zod v4
1 parent 7985c23 commit 3444e8d

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

packages/plugin-jsdocs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dependencies": {
3838
"@code-pushup/models": "0.69.5",
3939
"@code-pushup/utils": "0.69.5",
40-
"zod": "^3.22.4",
40+
"zod": "^4.0.5",
4141
"ts-morph": "^24.0.0"
4242
}
4343
}

packages/plugin-jsdocs/src/lib/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { z } from 'zod';
22

3-
const patternsSchema = z.union([z.string(), z.array(z.string()).min(1)], {
4-
description: 'Glob pattern to match source files to evaluate.',
5-
});
3+
const patternsSchema = z
4+
.union([z.string(), z.array(z.string()).min(1)])
5+
.describe('Glob pattern to match source files to evaluate.');
66

77
const jsDocsTargetObjectSchema = z
88
.object({

packages/plugin-jsdocs/src/lib/config.unit.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('JsDocsPlugin Configuration', () => {
4949
jsDocsPluginConfigSchema.parse({
5050
patterns: 123,
5151
}),
52-
).toThrow('Expected array');
52+
).toThrow('Invalid input');
5353
});
5454
});
5555

@@ -85,7 +85,7 @@ describe('JsDocsPlugin Configuration', () => {
8585
onlyAudits: 'functions-coverage',
8686
patterns: ['src/**/*.ts'],
8787
}),
88-
).toThrow('Expected array');
88+
).toThrow('Invalid input');
8989
});
9090

9191
it('throws for array with non-string elements', () => {
@@ -94,7 +94,7 @@ describe('JsDocsPlugin Configuration', () => {
9494
onlyAudits: [123, true],
9595
patterns: ['src/**/*.ts'],
9696
}),
97-
).toThrow('Expected string, received number');
97+
).toThrow('Invalid input');
9898
});
9999
});
100100

@@ -130,7 +130,7 @@ describe('JsDocsPlugin Configuration', () => {
130130
skipAudits: 'functions-coverage',
131131
patterns: ['src/**/*.ts'],
132132
}),
133-
).toThrow('Expected array');
133+
).toThrow('Invalid input');
134134
});
135135

136136
it('throws for array with non-string elements', () => {
@@ -139,7 +139,7 @@ describe('JsDocsPlugin Configuration', () => {
139139
skipAudits: [123, true],
140140
patterns: ['src/**/*.ts'],
141141
}),
142-
).toThrow('Expected string');
142+
).toThrow('Invalid input');
143143
});
144144
});
145145
});

packages/plugin-jsdocs/src/lib/jsdocs-plugin.unit.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ describe('jsDocsPlugin', () => {
4343

4444
it('should throw for invalid plugin options', () => {
4545
expect(() =>
46-
jsDocsPlugin({
47-
// @ts-expect-error testing invalid config
48-
patterns: 123,
49-
}),
50-
).toThrow('Expected array, received number');
46+
// @ts-expect-error testing invalid config
47+
jsDocsPlugin({ patterns: 123 }),
48+
).toThrow('Invalid input');
5149
});
5250

5351
it('should filter groups', () => {

0 commit comments

Comments
 (0)