Skip to content

Commit bde98bb

Browse files
trueadmRich-Harris
andcommitted
chore: tweak test config for hmr test run (#12423)
* conflict * conflict * lint * add comments * Update packages/svelte/tests/runtime-runes/samples/spread-props/_config.js Co-authored-by: Rich Harris <[email protected]> --------- Co-authored-by: Rich Harris <[email protected]>
1 parent 9ac4b9c commit bde98bb

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

packages/svelte/tests/runtime-legacy/samples/component-not-constructor2/_config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { test } from '../../test';
22

33
export default test({
4+
compileOptions: {
5+
// override process.env.HMR — this test only passes in prod mode because in dev mode we generate a helpful error
6+
dev: false
7+
},
8+
49
get props() {
510
return { componentName: 'Sub' };
611
},

packages/svelte/tests/runtime-legacy/shared.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,13 @@ export function runtime_suite(runes: boolean) {
138138
}
139139

140140
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+
141143
const compileOptions: CompileOptions = {
142144
generate: 'client',
143145
rootDir: cwd,
144-
dev: process.env.HMR ? true : undefined,
145-
hmr: process.env.HMR ? true : undefined,
146+
dev: force_hmr ? true : undefined,
147+
hmr: force_hmr ? true : undefined,
146148
...config.compileOptions,
147149
immutable: config.immutable,
148150
accessors: 'accessors' in config ? config.accessors : true,

packages/svelte/tests/runtime-runes/samples/bind-this-proxy/_config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { flushSync } from 'svelte';
22
import { test } from '../../test';
33

44
export default test({
5+
compileOptions: {
6+
// override process.env.HMR — this test only passes in prod mode, because in dev we add `$destroy` methods etc
7+
dev: false
8+
},
9+
510
html: `<button>Toggle</button><div>Hello\nworld</div>`,
611

712
async test({ assert, target, logs }) {

0 commit comments

Comments
 (0)