DEV Community

Drash Land
Drash Land

Posted on • Updated on

Rhum v2 Coming At Ya!

(Edit 2021-04-04: Release date changed to July 1, 2021)
(Edit 2022-04-17: Rhum v2 was released, but it's not what we state in this post. Read more about Rhum v2 here.)

Rhum is coming out with its very own CLI in its v2 release!

Table of Contents

Why

During our time developing Rhum v1.x, we realized that maintaining Deno.test() under the hood was a bit difficult. It also convoluted the codebase when it came to managing hooks and outputting test results. Basically, it was not flexible and easy to maintain. With that in mind, we decided a Rhum CLI was the best way to move forward.

Findings

After a couple days of developing a prototype, we found that it was super flexible and the codebase was a lot cleaner than having Deno.test() under the hood. We were able to add subcommand options easily in the CLI such as ...

--filter-test-case="someTestCaseName"
--filter-test-suite="someTestSuiteName"
--ignore="dir|file"
Enter fullscreen mode Exit fullscreen mode

... and output prettier test results:

If you look closely at the above screenshot, you will see that the Actual/Diff output shows exactly what file threw the assertion error and on what line. This makes debugging faster than sifting through an error stack trace message. Needless to say, we like this feature a lot :).

Current CLI State

The current state of the CLI can be seen by its current help menu:

Rhum v2.0.0 - A lightweight testing framework for Deno.

USAGE

    rhum [subcommand] [options] [directory|file]

SUBCOMMANDS

    make [file]
        Make a test file.

    test [options] [directory|file]
        Run tests by specifying a test directory or test file.

    help, --help
        Display the help menu.

    version, --version
        Display Rhum version.


OPTIONS

    Options are categorized by subcommand.

    test
        --filter-test-case
            Execute the matching test case in the file(s) being tested. This
            option cannot be used with --filter-test-suite.
        --filter-test-suite
            Execute the matching test suite in the file(s) being tested. This
            option cannot be used with --filter-test-case.
        --ignore
            Ignore a set of directories or files.


EXAMPLE USAGE

    Execute the matching test case in the file(s) being tested.
        rhum test --filter-test-case="my test case" test_file.ts
        rhum test --filter-test-case="my test case" some_dir/

    Execute the matching test case in the file(s) being tested.
        rhum test --filter-test-suite="my test suite" test_file.ts
        rhum test --filter-test-suite="my test suite" some_dir/

    Execute all tests, but ignore directories/files.
        rhum test --ignore=./tests/data tests/
        rhum test --ignore=./tests/data,./tests/ignore tests/
        rhum test --ignore=./tests/test_1.ts tests/
        rhum test --ignore=./tests/test_1.ts,./tests/test_2.ts tests/

    Make a test file at /my/project/tests/my_test.ts
        rhum make /my/project/tests/my_test.ts

    Display the help menu.
        rhum help

    Display the Rhum version.
        rhum version
Enter fullscreen mode Exit fullscreen mode

When

Rhum v2 is set to be released on January 1, 2021. We figured this date gives us enough time to:

  • add more validation features such as .lastCalledWith() and .lastReturned()
  • make the CLI feature-rich and user-friendly;
  • document new features;
  • write tutorials; and
  • write extensive tests.

Follow

Want to keep up to date with the latest Rhum v2 progress? Join the Drash Land discord at https://discord.gg/6XkVDE, or simply follow the pinned GitHub issue below:

https://github.com/drashland/rhum/issues/75

Thanks for reading and keep developing with confidence, friends.

Latest comments (0)