Skip to content

MuNeNiCK/voltest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voltest

Voltest runs frontend tests for Volt projects.

It compiles test modules with Volt, resolves imports through Volt plugins and aliases, executes the compiled test bundle, and reports results through Mix.

Usage

Add Voltest to a project that already uses Volt:

def deps do
  [
    {:volt, "~> 0.13"},
    {:voltest, "~> 0.1", only: [:dev, :test], runtime: false}
  ]
end

Then run frontend test files with:

mix voltest

Specific files or directories can be passed explicitly:

mix voltest assets/test/example.test.ts
mix voltest assets/test --grep "updates state"

Test API

Test files can import from voltest:

import { describe, expect, test } from "voltest";

describe("math", () => {
  test("adds numbers", () => {
    expect(1 + 1).toBe(2);
  });
});

Voltest also resolves vitest imports to the same runtime API for projects that already have Vitest-style frontend tests.

Scope

Voltest currently provides:

  • describe, test / it, skip, only, and each
  • beforeAll, beforeEach, afterEach, and afterAll
  • common expect matchers
  • vi.fn, vi.spyOn, vi.mocked, and mock reset / restore helpers
  • top-level vi.mock support through a Volt transform
  • basic browser-like primitives including Headers, Request, Response, location, events, localStorage, and sessionStorage

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors