Skip to content

Commit a790338

Browse files
committed
fix(test): add @ts-expect-error comments for intentional type mismatches
1 parent 5474538 commit a790338

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

test/argv-flags.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,16 @@ describe('argv/flags', () => {
415415

416416
describe('edge cases', () => {
417417
it('should handle truthy values as boolean true', () => {
418+
// @ts-expect-error - Testing runtime coercion of non-boolean values
418419
expect(isDebug({ debug: 1 } as FlagValues)).toBe(true)
420+
// @ts-expect-error - Testing runtime coercion of non-boolean values
419421
expect(isVerbose({ verbose: 'yes' } as FlagValues)).toBe(true)
420422
})
421423

422424
it('should handle falsy values as boolean false', () => {
425+
// @ts-expect-error - Testing runtime coercion of non-boolean values
423426
expect(isDebug({ debug: 0 } as FlagValues)).toBe(false)
427+
// @ts-expect-error - Testing runtime coercion of non-boolean values
424428
expect(isDebug({ debug: '' } as FlagValues)).toBe(false)
425429
})
426430

test/cacache.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ describe('cacache', () => {
443443
expect(removed).toBeGreaterThanOrEqual(0)
444444

445445
// Verify cleared
446+
// @ts-expect-error - safeGet signature doesn't match map callback but works at runtime
446447
const results = await Promise.all(keys.map(safeGet))
447448
results.forEach(result => expect(result).toBeUndefined())
448449
} catch (e) {
@@ -568,6 +569,7 @@ describe('cacache', () => {
568569
await Promise.all(keys.map(key => put(key, `data-${key}`)))
569570

570571
// Concurrent gets
572+
// @ts-expect-error - safeGet signature doesn't match map callback but works at runtime
571573
const entries = await Promise.all(keys.map(safeGet))
572574
entries.forEach(entry => {
573575
if (entry) {

test/json.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ describe('json', () => {
679679
it('should handle array-like objects with non-number first element', () => {
680680
// Tests line 166-171: length > 0 but obj[0] is not a number
681681
expect(() => {
682+
// @ts-expect-error - Testing Buffer-like object with invalid method signatures
682683
jsonParse({
683684
length: 1,
684685
0: 'not a number',
@@ -691,6 +692,7 @@ describe('json', () => {
691692
it('should handle objects without proper constructor', () => {
692693
// Tests line 174-177: constructor.isBuffer checks
693694
expect(() => {
695+
// @ts-expect-error - Testing Buffer-like object with invalid method signatures
694696
jsonParse({
695697
length: 0,
696698
copy: () => {},
@@ -700,6 +702,7 @@ describe('json', () => {
700702
}).toThrow()
701703

702704
expect(() => {
705+
// @ts-expect-error - Testing Buffer-like object with invalid method signatures
703706
jsonParse({
704707
length: 0,
705708
copy: () => {},

0 commit comments

Comments
 (0)