From 109cc3b3380274d83e83de61647086376af0d406 Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Tue, 17 Oct 2023 11:56:31 +0200 Subject: [PATCH] Ignore (only) the generated `.astro/types.d.ts` file --- fixtures/plugins/astro/knip.ts | 1 + tests/plugins/astro.test.ts | 13 +++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/fixtures/plugins/astro/knip.ts b/fixtures/plugins/astro/knip.ts index e8bca4c78..046c48e71 100644 --- a/fixtures/plugins/astro/knip.ts +++ b/fixtures/plugins/astro/knip.ts @@ -1,4 +1,5 @@ export default { + ignore: '.astro/types.d.ts', compilers: { astro: (text: string) => [...text.matchAll(/import[^;]+/g)].join('\n'), css: (text: string) => [...text.matchAll(/(?<=@)import[^;]+/g)].join('\n'), diff --git a/tests/plugins/astro.test.ts b/tests/plugins/astro.test.ts index 58085f317..990cb9a31 100644 --- a/tests/plugins/astro.test.ts +++ b/tests/plugins/astro.test.ts @@ -8,21 +8,14 @@ import baseCounters from '../helpers/baseCounters.js'; const cwd = resolve('fixtures/plugins/astro'); test('Find dependencies in Astro configuration', async () => { - const { issues, counters } = await main({ + const { counters } = await main({ ...baseArguments, cwd, }); - assert(issues.unlisted['src/content/config.ts']['astro:content']); - assert(issues.unlisted['src/pages/rss.xml.js']['astro:content']); - assert(issues.unlisted['src/pages/blog/[...slug].astro']['astro:content']); - assert(issues.unlisted['src/pages/blog/index.astro']['astro:content']); - assert(issues.unlisted['src/layouts/BlogPost.astro']['astro:content']); - assert.deepEqual(counters, { ...baseCounters, - unlisted: 5, - processed: 17, - total: 17, + processed: 18, + total: 18, }); });