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 <rich.harris@vercel.com>

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/12433/head
Dominic Gannaway 1 year ago committed by GitHub
parent 7ea418b2f8
commit e8453e75c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,6 +1,11 @@
import { test } from '../../test';
export default test({
compileOptions: {
// override process.env.HMR — this test only passes in prod mode because in dev mode we generate a helpful error
dev: false
},
get props() {
return { componentName: 'Sub' };
},

@ -138,11 +138,13 @@ export function runtime_suite(runes: boolean) {
}
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 = {
generate: 'client',
rootDir: cwd,
dev: process.env.HMR ? true : undefined,
hmr: process.env.HMR ? true : undefined,
dev: force_hmr ? true : undefined,
hmr: force_hmr ? true : undefined,
...config.compileOptions,
immutable: config.immutable,
accessors: 'accessors' in config ? config.accessors : true,

@ -2,6 +2,11 @@ import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
compileOptions: {
// override process.env.HMR — this test only passes in prod mode, because in dev we add `$destroy` methods etc
dev: false
},
html: `<button>Toggle</button><div>Hello\nworld</div>`,
async test({ assert, target, logs }) {

Loading…
Cancel
Save