Skip to content

testing-library/svelte-testing-library

Repository files navigation

svelte-testing-library

WIP

Installation

npm i -D svelte-testing-library

Usage

App.svelte

<script>
  export let name;
</script>

<style>
  h1 {
    color: purple;
  }
</style>

<h1>Hello {name}!</h1>

App.spec.js

import App from "../src/App.svelte";
import { render } from "../src";
describe("App", () => {
  test("should render", () => {
    const { getByText } = render(App, { name: "world" });

    expect(getByText("Hello world!"));
  });
});

About

🐿️ Simple and complete Svelte DOM testing utilities that encourage good testing practices

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 31