khutzpa

0.0.1-alpha.17 • Public • Published

khutzpa

Node powered, cross-platform, drop-in replacement for Chutzpah.exe that provides easy access to JavaScript testing with Jasmine, providing both pass/fail test results and code coverage measurements on the command-line and in html formats.

khutzpa provides:

  1. A Mocha reporter for the command line,
  2. A Jasmine stand-alone runner for in-browser test reporting, and
  3. Coverage reports made with Istabul via karma and Jasmine chai (?)
    • (Maybe? Not sure how chai & sinon are running jasmine syntax tests.)

khutzpa is designed to be run from the command line and/or using the Chutzpah Runner for VS Code. Future plans include a Visual Studio Classic extension set.

Amazingly, it seems to mostly work.


Installation & Quickstart

npm install khutzpa -g

(Yes, please install globally. Yes, you'll need to know what npm is.)

Then, to run all tests as defined by a single Chutzpah.json configuration file:

khutzpa /path/to/config/Chutzpah.json /{command}

On the command line, khutzpa currently at least partially supports these legacy options:

  • File path
    • This can be a directory, a single specific Chutzpah.json file, or a single specific test file.
    • Must be the first option
  • Common /{command}s:
    • /openInBrowser
      • Can occur anywhere (except the first option, which is the path)
      • If no /{command} is given, this is the default.
      • Means we're running the Jasmine stand-alone test suite and serving the results in a browser.
    • /coverage
      • Can occur anywhere (except the first option, which is the path)
      • Currently very limited.
        • A coverage run will be performed in Chrome (corollary: Chrome must be installed)
        • It is written to a coverage dir at the same root as your Chutzpah.json
        • It is opened in your default browser

Example:

If you've installed on macOS with node set up conventionally, this likely will run the included test site's test suite.

khutzpa /usr/local/lib/node_modules/khutzpa/tests/fakeSite/Chutzpah.json /openInBrowser

... or, for Windows (replace [yourUser])...

khutzpa C:\Users\[yourUser]\AppData\Roaming\npm\node_modules\khutzpa\tests\fakeSite\Chutzpah.json /openInBrowser

See the wiki for in-depth explanations about these and other commands, configurations, and options.


In-depth info, including VSCode usage


Background

What's wrong with Chutzpah?

Chutzpah was/is a command-line wrapper for running Jasmine testing and blanket.js test coverage tools for JavaScript projects.

The good thing about Chutzpah is that it's a wrapper around a complex set of tools making it exceptionally easy to set them up even without a thorough knowledge of those tools it uses.

The bad thing about Chutzpah is that it's a wrapper around a complex set of tools, and if the tools it's wrapped go stale, it's insanely difficult to update them. Not to mention all that shielding it did for you initially now means you've potentially got no clue what's up under the hood.

Unfortunately, at this point, Chutzpah's tools are too damn stale. blanket.js hasn't been updated (outside of its license) since 2016 and it doesn't support es6 well. Chutzpah's embedded version of Jasmine isn't much better (though it is a little better. ;^D).

You can learn more about those issues at the Chutzpah project. Here's one that explains that its coverage tool is toast:

Coverage does not work on anything but phantom.js and there are no plans to fix that since the library coverage is built on is deprecated so it would require a total rewrite.

Let's fix that by replacing Chutzpah's out of date pieces with modern tools. Jasmine standalone has been upated. We're using karma and istanbul-lib-coverage for coverage instead of likely defunct blanket.js. We're no longer using PhantomJS to run headless tests (so we can use es6 and up!) and are using Chrome [and only Chrome for now]. You get the point.


Future work

Chutzpah (the original) has excellent Visual Studio integration, including an extension for VS 2019 and 2022.

Currently khutzpa (this pretender to the throne) does not have a Visual Studio "Classic" extension.

Note: I am hopeful we can steal the code to the VS Classic extension (like the context menu stuff from here) and swap out Chutzpah.exe with khutzpa and have an extension working again, but I want this working in VS Code's Chutzpah Runner extension and my builds before we get too far into VS Classic support.


Acknowledgements

As of 24 May 2023...

Each of these may include other dependencies in their package.json requirements. Please review each project for further details.

Package Sidebar

Install

npm i khutzpa

Weekly Downloads

1

Version

0.0.1-alpha.17

License

Apache-2.0

Unpacked Size

568 kB

Total Files

46

Last publish

Collaborators

  • rufwork