Skip to content

Commit 381ffbb

Browse files
committed
wip
1 parent 0a48be4 commit 381ffbb

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

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

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('TypescriptPlugin Configuration', () => {
1212
expect(() =>
1313
typescriptPluginConfigSchema.parse({
1414
tsConfigPath,
15-
tsCodes: [1000, 1002],
15+
onlyAudits: ['ts-code-1065', 'ts-code-2354'],
1616
} satisfies TypescriptPluginOptions),
1717
).not.toThrow();
1818
});
@@ -30,55 +30,46 @@ describe('TypescriptPlugin Configuration', () => {
3030
it('throws for invalid tsConfigPath type', () => {
3131
expect(() =>
3232
typescriptPluginConfigSchema.parse({
33-
tsConfigPath: 123,
33+
onlyAudits: 123,
3434
}),
35-
).toThrow('Expected string');
35+
).toThrow('invalid_type');
3636
});
3737
});
3838

39-
describe('tsCodes', () => {
40-
it('accepts a valid `tsCodes` array', () => {
39+
describe('onlyAudits', () => {
40+
it('accepts a valid `onlyAudits` array', () => {
4141
expect(() =>
4242
typescriptPluginConfigSchema.parse({
4343
tsConfigPath,
44-
tsCodes: [1000, 1002],
45-
}),
44+
onlyAudits: ['ts-code-1065', 'argument-expected-1011'],
45+
} satisfies TypescriptPluginOptions),
4646
).not.toThrow();
4747
});
4848

4949
it('accepts empty array for tsCodes', () => {
5050
expect(() =>
5151
typescriptPluginConfigSchema.parse({
5252
tsConfigPath,
53-
tsCodes: [],
54-
}),
53+
onlyAudits: [],
54+
} satisfies TypescriptPluginOptions),
5555
).not.toThrow();
5656
});
5757

5858
it('allows tsCodes to be undefined', () => {
5959
expect(() =>
6060
typescriptPluginConfigSchema.parse({
6161
tsConfigPath,
62-
}),
62+
} satisfies TypescriptPluginOptions),
6363
).not.toThrow();
6464
});
6565

66-
it('throws for invalid tsCodes type', () => {
67-
expect(() =>
68-
typescriptPluginConfigSchema.parse({
69-
tsConfigPath,
70-
tsCodes: 'invalidCodes',
71-
}),
72-
).toThrow('Expected array');
73-
});
74-
7566
it('throws for array with non-string elements', () => {
7667
expect(() =>
7768
typescriptPluginConfigSchema.parse({
7869
tsConfigPath,
79-
tsCodes: [123, true],
70+
onlyAudits: [123, true],
8071
}),
81-
).toThrow('Expected number, received boolean');
72+
).toThrow('invalid_type');
8273
});
8374
});
8475
});

packages/plugin-typescript/src/lib/runner/utils.unit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { DiagnosticCategory } from 'typescript';
22
import { describe, expect } from 'vitest';
3-
import { SUPPORTED_TS_ERROR_CODES } from '../constants.js';
3+
import { SUPPORTED_TS_ERROR_CODES } from '../internal/known-ts-error-codes.js';
44
import {
5-
codeToAuditSlug,
5+
codeToAuditCodeSlug,
66
getIssueFromDiagnostic,
77
getSeverity,
88
transformTSErrorCodeToAuditSlug,
@@ -23,9 +23,9 @@ describe('transformTSErrorCodeToAuditSlug', () => {
2323
});
2424
});
2525

26-
describe('codeToAuditSlug', () => {
26+
describe('codeToAuditCodeSlug', () => {
2727
it('should prodice ts-code audit', () => {
28-
expect(codeToAuditSlug(123)).toBe('ts-code-123');
28+
expect(codeToAuditCodeSlug(123)).toBe('ts-code-123');
2929
});
3030
});
3131

0 commit comments

Comments
 (0)