pull/12423/head
Dominic Gannaway 2 years ago
parent d967780c4f
commit 041bca1744

@ -34,14 +34,22 @@ export function hmr(source) {
// when the component is invalidated, replace it without transitions // when the component is invalidated, replace it without transitions
if (ran) set_should_intro(false); if (ran) set_should_intro(false);
var descriptors = Object.getOwnPropertyDescriptors(
// @ts-expect-error
new.target ? new component(anchor, props) : component(anchor, props)
)
// preserve getters/setters // preserve getters/setters
Object.defineProperties( for (var desc in descriptors) {
instance, debugger
Object.getOwnPropertyDescriptors( if (descriptors[desc].enumerable) {
// @ts-expect-error Object.defineProperty(
new.target ? new component(anchor, props) : component(anchor, props) instance,
) desc,
); descriptors[desc]
);
}
}
if (ran) set_should_intro(true); if (ran) set_should_intro(true);
}); });

@ -1,6 +1,10 @@
import { test } from '../../test'; import { test } from '../../test';
export default test({ export default test({
compileOptions: {
dev: false,
},
get props() { get props() {
return { componentName: 'Sub' }; return { componentName: 'Sub' };
}, },

@ -138,11 +138,13 @@ export function runtime_suite(runes: boolean) {
} }
async function common_setup(cwd: string, runes: boolean | undefined, config: RuntimeTest) { async function common_setup(cwd: string, runes: boolean | undefined, config: RuntimeTest) {
const force_hmr = process.env.HMR && config.compileOptions?.dev !== false && !config.error;
const compileOptions: CompileOptions = { const compileOptions: CompileOptions = {
generate: 'client', generate: 'client',
rootDir: cwd, rootDir: cwd,
dev: process.env.HMR ? true : undefined, dev: force_hmr ? true : undefined,
hmr: process.env.HMR ? true : undefined, hmr: force_hmr ? true : undefined,
...config.compileOptions, ...config.compileOptions,
immutable: config.immutable, immutable: config.immutable,
accessors: 'accessors' in config ? config.accessors : true, accessors: 'accessors' in config ? config.accessors : true,

@ -2,6 +2,10 @@ import { flushSync } from 'svelte';
import { test } from '../../test'; import { test } from '../../test';
export default test({ export default test({
compileOptions: {
dev: false,
},
html: `<button>Toggle</button><div>Hello\nworld</div>`, html: `<button>Toggle</button><div>Hello\nworld</div>`,
async test({ assert, target, logs }) { async test({ assert, target, logs }) {

@ -1,6 +1,10 @@
import { test } from '../../test'; import { test } from '../../test';
export default test({ export default test({
compileOptions: {
dev: false,
},
async test({ assert, target }) { async test({ assert, target }) {
assert.htmlEqual( assert.htmlEqual(
target.innerHTML, target.innerHTML,

Loading…
Cancel
Save