pickstack

SolidJS + Vitest

Vite-native test runner, with a sample counter component test. This page shows exactly what pickstack adds to a SolidJS project for Vitest: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.

$ npm create pickstack@latest my-app -- --framework solid --modules vitest --yes
Customize in the configurator

Packages it adds

PackageVersionType
jsdom^31.0.1dev
vitest^5.1.1dev

New files

src/components/Counter.test.tsx
import { render } from "solid-js/web";
import { describe, expect, it } from "vitest";
import Counter from "./Counter";

describe("Counter", () => {
  it("increments when +1 is clicked", () => {
    const container = document.createElement("div");
    document.body.append(container);
    const dispose = render(() => <Counter />, container);

    const plus = [...container.querySelectorAll("button")].find(
      (b) => b.textContent?.trim() === "+1",
    );
    plus?.click();

    expect(container.querySelector("p")?.textContent).toBe("1");

    dispose();
    container.remove();
  });
});

Changes to existing files

vite.config.ts (changed)
+/// <reference types="vitest/config" /> import { defineConfig } from "vite"; import solid from "vite-plugin-solid";   export default defineConfig({   plugins: [solid()],+  test: {+    environment: "jsdom",+  }, });  

Project files

Related templates