Skip to content

Commit b4aa934

Browse files
committed
feat(ui): Categorize NPM package deprecation issues
Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent ea3c3b6 commit b4aa934

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ui/src/helpers/get-issue-category.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { IssueCategory } from '@/schemas';
2525
// Unit tests can be run from the /ui folder with:
2626
// pnpm test
2727
const issueCategoryMap: Record<IssueCategory, RegExp[]> = {
28+
Deprecation: [/^deprecated .*/],
2829
Infrastructure: [
2930
/The .* worker failed due to an unexpected error.*/,
3031
/ERROR: Timeout after .* seconds while scanning file '.*'\./,
@@ -66,6 +67,18 @@ export const getIssueCategory = (message: string): IssueCategory => {
6667
if (import.meta.vitest) {
6768
const { it, expect } = import.meta.vitest;
6869

70+
it('correctly categorizes deprecation issues', () => {
71+
const messages = [
72+
'deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs',
73+
'deprecated [email protected]: Glob versions prior to v9 are no longer supported',
74+
'deprecated [email protected]: Please upgrade to version 7 or higher.',
75+
];
76+
77+
messages.forEach((message) => {
78+
expect(getIssueCategory(message)).toBe('Deprecation');
79+
});
80+
});
81+
6982
it('correctly categorizes infrastructure issues', () => {
7083
const messages = [
7184
'The analyzer worker failed due to an unexpected error.',

ui/src/schemas/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export type ItemResolved = z.infer<typeof itemResolvedSchema>;
3131
// Enum schema and type for the possible values of the issue categories.
3232
export const issueCategorySchema = z.enum([
3333
'Build System',
34+
'Deprecation',
3435
'Missing Data',
3536
'Infrastructure',
3637
'Other',

0 commit comments

Comments
 (0)