Skip to content

Add vite support ... ? #431

Open

Description

@gossi

I'm updating all my addons to be v2 and use vite for testing (no separate ember test app 🥳).

However, that makes code coverage to stop working, as it is tightly coupled to ember-cli.

One solution would be to write that middleware to collect code coverage for vite.

It raises the question though, that it would still run with istanbul and the code fragments it injects for measuring. As for the ecosystem is currently moving more towards native node coverage (through v8), I was wondering if a step-by-step re-architecture might be more useful. In terms, running tests soon in vitest browser mode, wo/ the need for testem soon becomes an option (ok, vitest browser mode would still use istanbul :D).

But for the internals my knowledge is limited, but I want to throw the idea into the room of having multiple parts (packages?) that do various things and can be combined for the test setup one has chosen to. One such part would be do the main translation between gts and whatever istanbul/v8 would understand. Another part is testem middleware and a third one would be a vite plugin that uses them.

So much for my thoughts on this one.

Activity

  1. kategengler commented on Jul 28, 2025

    @kategengler
    Collaborator

    I agree on re-architecting. That's long been the thought and the reason this is somewhat stagnant. We'd like to use browser coverage. I know @wagenet spiked it at one point.

    I suspect vitest browser mode is a ways off for our ecosystem. I've done testing and oddly enough testem is still one of the most reliable ways to test across browsers.

    You've summarized the parts well. As far as I know this plugin primarily:

    • Facilitates instrumentation
    • Translates between gjs/gts and js
    • Maps files from the old build system so as to exclude source from addons
    • Provides the middleware that collects coverage and writes the output
    • Outputs coverage in the UI (if running via the UI of qunit)

    In nearer term, I think a lot of what the addon does could be extracted into reusable parts that could be called directly from the host app or addon. The middleware could be used directly by testem rather than going through the ember-cli hook and the commands could work without ember-cli if we add our own command runner.

  2. gossi commented on Jul 29, 2025

    @gossi
    ContributorAuthor

    I suspect vitest browser mode is a ways off for our ecosystem. I've done testing and oddly enough testem is still one of the most reliable ways to test across browsers.

    I'm using vitest browser mode since it early days on a vanilla project and they are maturing at intense speed. Luckily with emberjs/rfcs#1099 we can use vitest from ember, so it is not too far away. It is using istanbul under the hood, so with the gts/gjs translation they are supported. I read a skeet today teasering built-in visual regression today - I'm hyped.

    For other tools, such testem there is other work to do, such as mapping, etc. However, I think, these are little pieces (not that much code I blindly assume right now).

    So maybe, there is a ember-code-coverage package, with these public modules:

    • ember-code-coverage/istanbul
    • ember-code-coverage/vite
    • ember-code-coverage/testem
    • ember-code-coverage/babel
  3. kategengler commented on Feb 17, 2026

    @kategengler
    Collaborator

    @gossi Are you interested in pursuing this?

  4. gossi commented on Feb 17, 2026

    @gossi
    ContributorAuthor

    Potentially yes, I still have it on my radar because I want it (which is the biggest motivator I guess 😁).

    I'm currently finishing a backend project, then this is a candidate again (there is also this one: embroider-build/embroider#2658)

    I'd reach out to you in discord, if this becomes idea materializes. Anyway ask me again in one month.

    That excludes template coverage. More the infra as proposed, with the current feature set.

  5. NullVoxPopuli commented on Feb 23, 2026

    @NullVoxPopuli

    I suspect vitest browser mode is a ways off

    is here: https://github.com/nullVoxPopuli/ember-vitest

    needs folks testing it out so it can become more robust tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions