Skip to content

A preset for Jest which allows for running CLJS tests in Jest

License

Notifications You must be signed in to change notification settings

pitch-io/cljest

Repository files navigation

cljest: ClojureScript + Jest Clojars Project

cljest is a way to run your ClojureScript files in Jest. It consists of two packages, one in Clojure and one in JavaScript, which allow you to take your ClojureScript tests and run them in Jest.

Installation

You'll need two packages, cljest and jest-preset-cljest.

Install jest-preset-cljest using NPM (or Yarn):

npm add --save-dev [email protected]

And then add cljest to your deps.edn or analagous file:

{:deps {com.pitch/cljest {:mvn/version "1.0.0"}}}

For more details, as well as details about getting started and configuration, please see the Installation documentation.

Documentation

Installation
Writing your first test
Migrating from cljs.test to cljest and differences
Unit tests
Component tests
Matchers
Mocking
Async code
General API docs
Running in CI/noninteractive environments
Important information about library versioning
Troubleshooting

Why Jest?

Succinctly:

Roadmap

The following items, in no particular order, are on the roadmap as potential additions or improvements to cljest:

  • Incremental test file compilation, which can give even better performance in a large codebase.
  • REPL support with JSDOM, so that you can test things on components with the REPL.

Contributing

Firstly, thanks!

Secondly, please fork the repository and create a PR with your changes. Just keep a couple of things in mind:

  • If your change is something that would impact users in a significant way(and therefore potentially requiring a major version bump), please raise an issue so that we can discuss it first.
  • Please add tests for your change. In general, if the change is end user facing, write your test in Jest/cljest, and otherwise (or if your code is Clojure, not ClojureScript), write your tests in Kaocha.

Issues and bugs

If something isn't working right, and it's not covered by the troubleshooting documentation, or if something is missing, or if you just generally encounter issues, please create an issue.

License

MIT