Title says it all! We released Rhum v2.0.0 yesterday 🙂. Need test doubles? Rhum got you.
Table of Contents
Release Summary
Basically, two things happened since v1:
- We removed the test runner (no more
testPlan
,testSuite
,testCase
, and hooks). I know... we're sad about it too. However, Deno's test runner has improved and has features that Rhum sought to add when Deno lacked them. - We improved the mock and stub test double APIs and introduced two others: fakes and dummies. The spy test double is currently in the works and will be included in a future minor release.
This being said, Rhum is strictly a test double library. For those currently using Rhum and want to continue using Rhum (for test doubles), we have a Migration Guide to v2 page that you can use to ease the migration process.
Rhum has zero dependencies -- not even Deno Standard Modules, which means it can be released to the Node.js ecosystem (yes, we plan to do exactly this 🙂).
You can view the full documentation at Drash Land - Rhum and the actual release at Releases - drashland/rhum.
New Concepts
Concepts from v1 to v2 have drastically changed. Rhum v1 had one goal: to provide pretty test result outputs (discussed here).
Now, Rhum only provides test doubles and they follow specific definitions (stated below).
Why the Test Double Definitions
Rhum's test doubles follow the test double definitions from Gerard Meszaros (as stated by Martin Fowler). We made it this way to prevent confusion on what test double to use during a system under test (SUT) and to make it easier to ask yourself questions like the following when writing tests:
- Should this be a fake?
- Should I pass in a mock to this constructor?
- Do I need to create an expectation on this service that I am testing?
- Does this need to be stubbed?
- Are we verifying behavior or state?
Our Experiences From Other Testing Libraries and Our Solution
We found that other testing libraries can create some overlap between test doubles. This makes it kind of difficult to know what test double to use, why to use it, and what you are verifying in tests. For example, some testing libraries only have the concept of mocking instead of spying, faking, or creating dummies. Furthermore, some testing libraries have mocks that can also be stubs using (Mocks Aren't Stubs). This can lead you to not testing anything if you're just stubbing everything in your tests.
From our experiences and knowing the test double definitions written on Martin Fowler's website (shoutout to Breno for showing us this along with more information from research on the differences!), we sought out to provide a solution for creating test doubles. Here we provide the problem and our solution.
Rhum's Future
History: A Year in the Making
It's been a little over a year since we last posted about Rhum v2. Since then, we had many internal discussions, thought about EOL'ing Rhum completely after the introduction of test groups/hooks in Deno, thought about making it agnostic to the runtime using it, thought about making a new test runner, started development, stopped development, wrote new plans and goals, etc. We couldn't really decide what to do with Rhum... and a year went by (time really flies)! Rhum has been the unit/integration testing backbone for all Drash Land modules and we didn't want to just throw it away. It wasn't until about a little over a week ago that Ed said he was going to write the Rhum v2 docs in our Discord. I didn't think he was serious, but I was game for it. Shortly after, we introduced the test doubles and prepped for release without looking back -- stopping development yet again. Now we're here... v2... and SUPER STOKED about it!
Looking Forward
As for Rhum's future, we will continue to develop it as a test double library. Soon, it will be officially available in the Node.js ecosystem with documentation that covers the following:
- CJS
- ESM (TypeScript)
- ESM (JavaScript)
Stay tuned for that! We're pretty excited to spill Rhum into the Node.js ecosystem.
Thanks for reading and happy testing!
-- Eric
Top comments (0)