Skip to content

Commit

Permalink
test(ssr-compiler): narrow which unused imports are expected (#4856)
Browse files Browse the repository at this point in the history
Co-authored-by: Nolan Lawson <[email protected]>
  • Loading branch information
wjhsf and nolanlawson authored Nov 13, 2024
1 parent 2c6875c commit 24fb303
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/@lwc/ssr-compiler/src/__tests__/fixtures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ async function compileFixture({ input, dirname }: { input: string; dirname: stri
modules: [{ dir: modulesDir }],
}),
],
onwarn({ message, code }) {
if (
code === 'CIRCULAR_DEPENDENCY' ||
// TODO [#4793]: fix unused imports
code === 'UNUSED_EXTERNAL_IMPORT'
) {
onwarn({ message, code, names }) {
if (code === 'CIRCULAR_DEPENDENCY') {
return;
}
// TODO [#4793]: fix unused imports
if (code === 'UNUSED_EXTERNAL_IMPORT') {
const unexpected = new Set(names);
const expected = ['connectContext', 'htmlEscape', 'track'];
expected.forEach((name) => unexpected.delete(name));
if (unexpected.size === 0) return;
}

throw new Error(message);
},
});
Expand Down

0 comments on commit 24fb303

Please sign in to comment.