DockYard / svelte-inline-compile

28 stars 1 forks source link

How to use with Vite? #8

Open thanhtschoepe opened 1 year ago

thanhtschoepe commented 1 year ago

As title said, I'd like to know how I can install with a vite setup

drewchandler commented 1 year ago

The in tests you can do something like
```js
/**
 * @vitest-environment jsdom
 */

import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/svelte';
import svelte from 'svelte-inline-compile'

describe('button', () => {
  it('renders a button', () => {
    render(svelte`<button>button</button>`)

    expect(screen.getByRole('button').textContent).toEqual('button')
  });
});

Let me know if that helps!