Frameworks and Utilities
Frameworks
There are two major testing frameworks that people use, Jest and Bun Test.
Notable points about Jest are:
- Jest is the most used framework among Obsidian plugins and thus there are many examples to look at
- Jest is slow, it can take multiple seconds just to run a few test
- Jest has some problems with ES-Modules
Notable points about Bun Test are:
- Bun Test is relatively new and only a few plugins use it, e.g. Meta Bind
- Bun Test is fast and this can speed up your development cycle
- It works well with cjs and esm modules as well as typescript out of the box
- The test API is not 100% complete yet and there are still some things missing
Both are viable options and in the end you have to decide on what fits best for your plugin and workflow.
Other Frameworks
There are other frameworks that people use, but I don’t have any experience with them, so I will just list them here.
Utilities
- Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG DOM and HTML.
- Approval Tests are a nicer version of snapshot tests