Skip to content

Commit 915470c

Browse files
committed
refactor(test): destructure!
1 parent f041337 commit 915470c

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

packages/@lwc/engine-server/src/__tests__/fixtures.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ function testFixtures(options?: RollupLwcOptions) {
130130
let result;
131131
let err;
132132
try {
133-
const module = (await import(compiledFixturePath)) as FixtureModule;
133+
const { default: module } = (await import(compiledFixturePath)) as FixtureModule;
134134
result = formatHTML(
135-
lwcEngineServer!.renderComponent('x-test', module!.default, config?.props ?? {})
135+
lwcEngineServer!.renderComponent('x-test', module, config?.props ?? {})
136136
);
137137
} catch (_err: any) {
138138
if (_err?.name === 'AssertionError') {

packages/@lwc/ssr-compiler/src/__tests__/fixtures.spec.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { DEFAULT_SSR_MODE, type CompilationMode } from '@lwc/shared';
1515
import { expectedFailures } from './utils/expected-failures';
1616

1717
interface FixtureModule {
18-
default: any;
18+
default: Parameters<typeof serverSideRenderComponent>[1];
1919
props?: { [key: string]: unknown };
2020
}
2121

@@ -99,19 +99,14 @@ describe.concurrent('fixtures', () => {
9999
};
100100
}
101101

102-
const module = (await import(compiledFixturePath)) as FixtureModule;
102+
const { default: module } = (await import(compiledFixturePath)) as FixtureModule;
103103

104104
let result;
105105
let error;
106106

107107
try {
108108
result = formatHTML(
109-
await serverSideRenderComponent(
110-
'x-test',
111-
module!.default,
112-
config?.props ?? {},
113-
SSR_MODE
114-
)
109+
await serverSideRenderComponent('x-test', module, config?.props ?? {}, SSR_MODE)
115110
);
116111
} catch (err: any) {
117112
error = err.message;

0 commit comments

Comments
 (0)