Skip to content

Commit

Permalink
Add coverage for unused files with compiler extension
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 23, 2024
1 parent 2ef75cc commit c2e2712
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Empty file.
Empty file.
12 changes: 8 additions & 4 deletions packages/knip/test/compilers.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import { test } from 'bun:test';
import assert from 'node:assert/strict';
import { main } from '../src/index.js';
import { resolve } from '../src/util/path.js';
import { join, resolve } from '../src/util/path.js';
import baseArguments from './helpers/baseArguments.js';
import baseCounters from './helpers/baseCounters.js';

const cwd = resolve('fixtures/compilers');

test('Support compiler functions in config', async () => {
const { counters } = await main({
const { issues, counters } = await main({
...baseArguments,
cwd,
});

assert(issues.files.has(join(cwd, 'unused.css')));
assert(issues.files.has(join(cwd, 'unused.md')));

assert.deepEqual(counters, {
...baseCounters,
processed: 7,
total: 7,
files: 2,
processed: 9,
total: 9,
});
});

0 comments on commit c2e2712

Please sign in to comment.