mirror of https://github.com/sveltejs/svelte
chore: allow testing in production env 2 (#17590)
* Revert "chore: allow testing in production env (#16840)"
This reverts commit ffd65e90fe.
* new approach
fix-15339
parent
dd67655697
commit
2339a739ec
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let { foo = $bindable(42) } = $props();
|
||||
</script>
|
||||
|
||||
{foo};
|
||||
@ -0,0 +1,12 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ target }) {
|
||||
let button = target.querySelector('button');
|
||||
|
||||
button?.click();
|
||||
|
||||
flushSync();
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,19 @@
|
||||
<script>
|
||||
import Child from "./Child.svelte";
|
||||
|
||||
let foo;
|
||||
|
||||
function onerror(err) {
|
||||
// re-throw if it isn't the production error
|
||||
// do in a such way because config.error is checked via `includes`
|
||||
if (err.message !== 'https://svelte.dev/e/props_invalid_value') {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:boundary {onerror}>
|
||||
<Child bind:foo />
|
||||
</svelte:boundary>
|
||||
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { vi } from 'vitest';
|
||||
import { runtime_suite, ok } from '../runtime-legacy/shared';
|
||||
|
||||
vi.mock('esm-env', async (importEnv) => {
|
||||
return {
|
||||
...(await importEnv()),
|
||||
DEV: false
|
||||
};
|
||||
});
|
||||
|
||||
const { test, run } = runtime_suite(true);
|
||||
|
||||
export { test, ok };
|
||||
|
||||
await run(__dirname);
|
||||
@ -1,5 +0,0 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
production: true
|
||||
});
|
||||
Loading…
Reference in new issue