choojs / choojs/choo

Allow using `jsdom` with a local `window` on node for tests

Open
#577 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.8k
Forks
573
PR merge metrics
No merged PRs in 30d

Description

I have been thinking about how we could write simple tests without needing a full-stack testing solution up front. I think we can already test most of our choo applications with tools like `assert-html`, but it would be nice to have a way to test DOM events. `jsdom` seems like a perfect fit for this use case, but I'm not sure how I'd actually go about using it with `choo`. For one, `app.mount` expects a global window object, but I want to pass in local window objects to allow running tests in parallel. I think it'd be nice if we had some middle ground in between `app.mount` and `app.toString` that allowed using a DOM implementation like `jsdom` to render the application, but also allowed setting up an initial state and route like `app.toString`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.