Skip to content

Commit 74e8063

Browse files
committed
Merge branch 'master' into wjh/rewire
2 parents 9c43f4d + b6c0276 commit 74e8063

File tree

58 files changed

+324
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+324
-45
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { rollup } from 'rollup';
1111
import lwcRollupPlugin from '@lwc/rollup-plugin';
1212
import { testFixtureDir, formatHTML } from '@lwc/test-utils-lwc-internals';
1313
import { setFeatureFlagForTest } from '../index';
14+
import type { FeatureFlagName } from '@lwc/features/dist/types';
1415
import type { RollupLwcOptions } from '@lwc/rollup-plugin';
1516
import type * as lwc from '../index';
1617

@@ -128,16 +129,17 @@ function testFixtures(options?: RollupLwcOptions) {
128129
// the LightningElement. Therefor the compiled module should also be evaluated in the
129130
// same sandbox registry as the engine.
130131
const lwcEngineServer = await import('../index');
131-
const module = (await import(compiledFixturePath)) as FixtureModule;
132-
133-
const features = module!.features ?? [];
134-
features.forEach((flag) => {
135-
lwcEngineServer!.setFeatureFlagForTest(flag, true);
136-
});
137132

138133
let result;
139134
let err;
135+
let features: FeatureFlagName[] = [];
140136
try {
137+
const module = (await import(compiledFixturePath)) as FixtureModule;
138+
139+
features = module!.features ?? [];
140+
features.forEach((flag) => {
141+
lwcEngineServer!.setFeatureFlagForTest(flag, true);
142+
});
141143
result = formatHTML(
142144
lwcEngineServer!.renderComponent(
143145
module!.tagName,
@@ -146,10 +148,10 @@ function testFixtures(options?: RollupLwcOptions) {
146148
)
147149
);
148150
} catch (_err: any) {
149-
if (_err.name === 'AssertionError') {
151+
if (_err?.name === 'AssertionError') {
150152
throw _err;
151153
}
152-
err = _err.message;
154+
err = _err?.message || 'An empty error occurred?!';
153155
}
154156

155157
features.forEach((flag) => {

packages/@lwc/engine-server/src/__tests__/fixtures/api/decorated-getter/error.txt

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<x-parent>
2+
<template shadowrootmode="open">
3+
<x-child>
4+
<template shadowrootmode="open">
5+
const setter getter api value
6+
</template>
7+
</x-child>
8+
<x-child>
9+
<template shadowrootmode="open">
10+
setter getter api value
11+
</template>
12+
</x-child>
13+
</template>
14+
</x-parent>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const tagName = 'x-parent';
2+
export { default } from 'x/parent';
3+
export * from 'x/parent';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
{setterGetterApi}
3+
</template>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { LightningElement, api } from 'lwc';
2+
3+
export default class Child extends LightningElement {
4+
set setterGetterApi(value) {
5+
this._someApi = value;
6+
}
7+
8+
@api
9+
get setterGetterApi() {
10+
return this._someApi;
11+
}
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<template>
2+
<x-child setter-getter-api="const setter getter api value"></x-child>
3+
<x-child setter-getter-api={setterGetterApiValue}></x-child>
4+
</template>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { LightningElement } from 'lwc';
2+
3+
export default class Parent extends LightningElement {
4+
setterGetterApiValue = 'setter getter api value';
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LWC1112: @api get setterGetterApi and @api set setterGetterApi detected in class declaration. Only one of the two needs to be decorated with @api.

packages/@lwc/engine-server/src/__tests__/fixtures/api/decorated-setter-getter/expected.html

Whitespace-only changes.

0 commit comments

Comments
 (0)