Skip to content

Commit 3d551db

Browse files
committed
Add more coverage for tag hints
1 parent 35cf1b7 commit 3d551db

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/knip/test/tags.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { test } from 'bun:test';
22
import assert from 'node:assert/strict';
33
import { main } from '../src/index.js';
4-
import { resolve } from '../src/util/path.js';
4+
import { join, resolve } from '../src/util/path.js';
55
import baseArguments from './helpers/baseArguments.js';
66
import baseCounters from './helpers/baseCounters.js';
77

@@ -64,7 +64,7 @@ test('Include or exclude tagged exports (include)', async () => {
6464
});
6565

6666
test('Include or exclude tagged exports (exclude)', async () => {
67-
const { issues, counters } = await main({
67+
const { issues, counters, tagHints } = await main({
6868
...baseArguments,
6969
cwd,
7070
tags: [[], ['custom']],
@@ -78,6 +78,18 @@ test('Include or exclude tagged exports (exclude)', async () => {
7878
assert(issues.enumMembers['tags.ts']['UnusedUntagged']);
7979
assert(issues.enumMembers['tags.ts']['UnusedInternal']);
8080

81+
assert.deepEqual(
82+
tagHints,
83+
new Set([
84+
{
85+
type: 'tag',
86+
filePath: join(cwd, 'unimported.ts'),
87+
identifier: 'ignored',
88+
tagName: '@custom',
89+
},
90+
])
91+
);
92+
8193
assert.deepEqual(counters, {
8294
...baseCounters,
8395
exports: 3,

0 commit comments

Comments
 (0)