A simple yet powerful testing framework for Node.js
Japa comes with all the tools you need to test your backend applications. Be it testing JSON APIs using Open API schema or writing browser tests using Playwright.
Despite being a small and simple test runner, Japa comes with all the basic features you expect from a great testing framework. It includes
- Support for asynchronous tests.
- Official plugins for chai assert and jest expect assertion libraries.
- Coverage reporting using nyc and c8.
- Ability to pin and run only selected tests.
- Works with ESM and TypeScript both with zero additional setup
Open API schema driven API testing
The API client plugin of Japa has first-class support for testing API endpoints against an Open API schema.
- You have to register the schema file path.
- The responses are matched based upon the request URL, method, and response status.
Browser testing using Playwright
The browser client of Japa is built on top of Playwright and you can use it to write end-to-end browser tests.
- Automatic management of browser and browser context.
- Class based pages and interactions to de-compose tests into small testable units.
- Web first assertions.
- Control headless mode, debugging, and enable tracing using command-line flags
Dataset driven tests
Datasets allow you to test a function output against varying inputs.
For example, instead of writing multiple tests to validate different email formats, you can write a single test and use datasets to run it with a different email each time.
Test suites and groups for better organisation
Japa allows you to divide unit, integration and functional tests as multiple suites. Each suite can have its lifecycle hooks.
On the other hand, groups allow you to bulk configure tests of similar nature.
No build tools required
For example, Jest uses
babel-jest, and Vitest uses
vite to transform your code before running tests.
The code transformation process is not needed for backend libraries and applications. So why pay the penalty in the first place?
If you are a Node.js backend developer, you will find Japa more natural and straightforward to work with in comparison to other mainstream testing frameworks.
Naturally works with TypeScript, ESM, and CJS
Japa does not use any CLI or build tools. Therefore, it allows Japa to blend with your existing workflows easily.
Be it a TypeScript project or ES modules. You can use Japa with no additional tooling required on our end.
Most of the core APIs of Japa are extensible.
- You can add custom behavior to the underlying test class using macros.
- Hook into the lifecycle of a suite, group or a test.
- Extend test context with custom properties.
- Develop custom plugins and reporters.
Run Japa tests within VSCode using keyboard shortcuts or code lenses. Download extension