kolodny / safetest

MIT License
1.3k stars 31 forks source link

Sveltekit compatibility #26

Open michaeldesigaud opened 2 months ago

michaeldesigaud commented 2 months ago

I try to use safetest in my sveltekit project but i struggle with the application boostrap in file /src/main.ts. My entry point is an app.html file with the following :

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%sveltekit.assets%/favicon.png" />
    <meta name="viewport" content="width=device-width" />
    %sveltekit.head%
  </head>
  <body data-sveltekit-preload-data="hover">
    <div style="display: contents">%sveltekit.body%</div>
  </body>
</html>

I'm not sure how to bootstrap that programmatically so that the app can be started in tests ?

kolodny commented 2 months ago

You'll need to create a component that will render the test component. Take a look at how NextJS does it, you'll need to do something similar, I'm not familiar enough with Sveltekit to know how to do this. Also take a look at how the React Bootstrap component is defined