File tree Expand file tree Collapse file tree 5 files changed +31
-7
lines changed
samples/component-not-constructor2 Expand file tree Collapse file tree 5 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,22 @@ export function hmr(source) {
34
34
// when the component is invalidated, replace it without transitions
35
35
if ( ran ) set_should_intro ( false ) ;
36
36
37
+ var descriptors = Object . getOwnPropertyDescriptors (
38
+ // @ts -expect-error
39
+ new . target ? new component ( anchor , props ) : component ( anchor , props )
40
+ )
41
+
37
42
// preserve getters/setters
38
- Object . defineProperties (
39
- instance ,
40
- Object . getOwnPropertyDescriptors (
41
- // @ts -expect-error
42
- new . target ? new component ( anchor , props ) : component ( anchor , props )
43
- )
44
- ) ;
43
+ for ( var desc in descriptors ) {
44
+ debugger
45
+ if ( descriptors [ desc ] . enumerable ) {
46
+ Object . defineProperty (
47
+ instance ,
48
+ desc ,
49
+ descriptors [ desc ]
50
+ ) ;
51
+ }
52
+ }
45
53
46
54
if ( ran ) set_should_intro ( true ) ;
47
55
} ) ;
Original file line number Diff line number Diff line change 1
1
import { test } from '../../test' ;
2
2
3
3
export default test ( {
4
+ compileOptions : {
5
+ dev : false ,
6
+ } ,
7
+
4
8
get props ( ) {
5
9
return { componentName : 'Sub' } ;
6
10
} ,
Original file line number Diff line number Diff line change @@ -138,9 +138,13 @@ export function runtime_suite(runes: boolean) {
138
138
}
139
139
140
140
async function common_setup ( cwd : string , runes : boolean | undefined , config : RuntimeTest ) {
141
+ const force_hmr = process . env . HMR && config . compileOptions ?. dev !== false && ! config . error ;
142
+
141
143
const compileOptions : CompileOptions = {
142
144
generate : 'client' ,
143
145
rootDir : cwd ,
146
+ dev : force_hmr ? true : undefined ,
147
+ hmr : force_hmr ? true : undefined ,
144
148
...config . compileOptions ,
145
149
immutable : config . immutable ,
146
150
accessors : 'accessors' in config ? config . accessors : true ,
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ import { flushSync } from 'svelte';
2
2
import { test } from '../../test' ;
3
3
4
4
export default test ( {
5
+ compileOptions : {
6
+ dev : false ,
7
+ } ,
8
+
5
9
html : `<button>Toggle</button><div>Hello\nworld</div>` ,
6
10
7
11
async test ( { assert, target, logs } ) {
Original file line number Diff line number Diff line change 1
1
import { test } from '../../test' ;
2
2
3
3
export default test ( {
4
+ compileOptions : {
5
+ dev : false ,
6
+ } ,
7
+
4
8
async test ( { assert, target } ) {
5
9
assert . htmlEqual (
6
10
target . innerHTML ,
You can’t perform that action at this time.
0 commit comments