Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 3 additions & 20 deletions packages/@lwc/engine-server/src/__tests__/fixtures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ import { rollup } from 'rollup';
import lwcRollupPlugin from '@lwc/rollup-plugin';
import { testFixtureDir, formatHTML } from '@lwc/test-utils-lwc-internals';
import { setFeatureFlagForTest } from '../index';
import type { FeatureFlagName } from '@lwc/features/dist/types';
import type { RollupLwcOptions } from '@lwc/rollup-plugin';
import type * as lwc from '../index';

interface FixtureModule {
tagName: string;
default: typeof lwc.LightningElement;
props?: { [key: string]: any };
features?: any[];
props?: { [key: string]: unknown };
}

vi.setConfig({ testTimeout: 10_000 /* 10 seconds */ });
Expand Down Expand Up @@ -132,20 +129,10 @@ function testFixtures(options?: RollupLwcOptions) {

let result;
let err;
let features: FeatureFlagName[] = [];
try {
const module = (await import(compiledFixturePath)) as FixtureModule;

features = module!.features ?? [];
features.forEach((flag) => {
lwcEngineServer!.setFeatureFlagForTest(flag, true);
});
const { default: module } = (await import(compiledFixturePath)) as FixtureModule;
result = formatHTML(
lwcEngineServer!.renderComponent(
module!.tagName,
module!.default,
config?.props ?? {}
)
lwcEngineServer!.renderComponent('fixture-test', module, config?.props ?? {})
);
} catch (_err: any) {
if (_err?.name === 'AssertionError') {
Expand All @@ -154,10 +141,6 @@ function testFixtures(options?: RollupLwcOptions) {
err = _err?.message || 'An empty error occurred?!';
}

features.forEach((flag) => {
lwcEngineServer!.setFeatureFlagForTest(flag, false);
});

return {
'expected.html': result,
'error.txt': err,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
<div>
</div>
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
ab
<div data-foo="1">
c
</div>
de
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
ab
<div>
c
</div>
de
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
ab
<div>
c
</div>
de
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<div>
abc
</div>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
ab
<div>
c
</div>
de
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
&amp;minus;
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
&amp;minus;
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<div>
‍‍‍
Expand All @@ -7,4 +7,4 @@
‍‍
</div>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<div>
Expand All @@ -11,4 +11,4 @@
‍‍
</div>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
haha0true
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
totoyolototoyolo
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
yolototo
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-comments-text>
<fixture-test>
<template shadowrootmode="open">
<span>
bar
</span>
</template>
</x-comments-text>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Loading
Loading