bahmutov / cypress-svelte-unit-test

Unit testing Svelte components in Cypress E2E test runner
162 stars 21 forks source link

External CSS won't get loaded #86

Open wyozi opened 4 years ago

wyozi commented 4 years ago

If there exists a CSS rollup config that separates the associated CSS into another file (as is done in default rollup template https://github.com/sveltejs/template/blob/master/rollup.config.js#L23-L25), the tests won't have access to the CSS

Workaround is to disable those lines in test mode.

johanbissemattsson commented 3 years ago

Another workaround is to include the bundled CSS file while mounting the component:

mount(HelloWorld, {
  props: {name: 'World'}
}, {
  stylesheet: '/__root/public/build/bundle.css',
})