Skip to content

TWDTest While Developing

because testing isn’t a phase, it’s part of the flow.

Quick Example

VIDEO HERE - Overview of TWD in action - showing the sidebar, running tests, and seeing results in real-time

ts
import { twd, userEvent } from "twd-js";
import { describe, it } from "twd-js/runner";

describe("User login", () => {
  it("should login successfully", async () => {
    await twd.visit("/login");
    
    const user = userEvent.setup();
    const emailInput = await twd.get("input#email");
    const passwordInput = await twd.get("input#password");
    const loginButton = await twd.get("button[type='submit']");
    
    await user.type(emailInput.el, "user@example.com");
    await user.type(passwordInput.el, "password123");
    await user.click(loginButton.el);
    
    const welcome = await twd.get("h1");
    welcome.should("contain.text", "Welcome");
  });
});

Why TWD?

TWD bridges the gap between development and testing by bringing tests directly into your development environment. Instead of running tests in a separate terminal, you can see results instantly in your browser's sidebar while you code.

Perfect for:

  • Frontend developers who want immediate test feedback
  • Teams practicing Testing while Developing (TWD)
  • React applications that need comprehensive UI testing
  • Projects requiring API mocking and integration testing

Community

Released under the MIT License.