Contains utilities to make tests
Last updated a year ago by yogo95 .
CECILL-2.1 · Repository · Original npm · Tarball · package.json
$ cnpm install js-zrim-test-bootstrap 
SYNC missed versions from official npm registry.

JavaScript Zrim Test Bootstrap


The goal of this project is to provide utilities to make test easier.

Test Launcher

The TestLauncher class use those environment variable to have the default behaviour:

  • ZE_DISABLE_CODE_COVERAGE : Disable the code coverage (set the variable to 1)


const TestLauncher = require('js-zrim-test-bootstrap').TestLauncher;

The test launcher is able to enable the coverage for your unit, integration and system test. This features is not available if you start the application in a different process or use cluster process.


By default the test launcher will use the configuration given to the configure function. Some configuration can be override by some environment variables.


The module export a builder which help you generate the configuration. The test launcher can be configured without the builder.


Unit Test

In this example, we use the configuration builder to help us create the configuration with a nicer look.

And in case of success we start the test. The coverage and test result will automatically be saved.

const TestLauncher = require('js-zrim-test-bootstrap').TestLauncher,
  TestLauncherConfigBuilder = require('js-zrim-test-bootstrap').TestLauncherConfigBuilder,
  util = require('util');

const testLauncher = new TestLauncher(),
  configBuilder = new TestLauncherConfigBuilder();

  .rootDirectoryPath(__dirname + '/../..')
  .withPreLaunchStep(function (context) {
    return new Promise(resolve => {
      // So something before istanbul is launch
  .withPreTestLaunchStep(function (context) {
      return new Promise(resolve => {
        // So something before jasmine is launch and after istanbul is started
  .withCleanUpStep(function (context) {
    return new Promise(resolve => {
      // Do some cleanup

  .then(() => testLauncher.run())
  .catch(error => {
    process.stderr.write(`Something goes wrong: ${error.message}\n${error.stack}`);

The reports will automatically created to ROOT_PROJECT/reports/test/unit

Current Tags

7 Versions

Maintainers (1)
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 10
Dependencies (10)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |