Skip to content

Is there interest in a Volt-native test runner? #22

@MuNeNiCK

Description

@MuNeNiCK

Hi, I wanted to ask whether there are any plans or thoughts around testing support for Volt projects.

I am currently trying to migrate an Elixir + Vite application to Volt. Volt seems like it can cover the build side of that workflow well, but I was not sure what the intended direction is for frontend tests that are currently run with Vitest.

To explore this, I put together a small experimental repository called Voltest:

https://github.com/MuNeNiCK/voltest

The idea is to run frontend test files through Volt itself: compile test modules with Volt, resolve imports using Volt plugins and aliases, and execute the compiled bundle from a Mix task.

The repository currently includes a small initial test API:

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

This is still experimental, and I mainly wanted to make the idea concrete enough to discuss.

If Volt already has a direction for testing, I would be interested in learning more about it.

If this direction seems useful, would it make sense for something like this to live under the elixir-volt organization?

I would be happy to transfer the repository if that helps, or adapt it in whatever way best fits Volt. The name, implementation, and scope are all flexible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions