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

Zrim Test Bootstrap

Introduction

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

It allow to have an index file where to always start the test, this is usefull to prepare variable for test.

See SimpleTestLauncher for the launcher and configs for configuration helpers.

Examples

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.

import {SimpleTestLauncher, configs} from 'zrim-test-bootstrap';
import * as pathUtils from 'path';

const configBuilder = new configs.SimpleTestLauncherConfigBuilder();
const rootDirectoryPath = pathUtils.resolve(__dirname + '/../../..');

// You are now in PROJECT_DIR/src/test/unit/index.js

configBuilder
  .projectConfiguration()
  .rootDirectoryPath(rootDirectoryPath)
  .parentBuilder()
  .coverageConfiguration()
  .enableSummary(true)
  .parentBuilder()
  .testConfiguration()
  .unitTest()
  .specDirPath(pathUtils.relative(rootDirectoryPath, __dirname))
  .parentBuilder()
  .withPreLaunchStep(async function (context) {
    // So something before istanbul is launch
  })
  .withPreTestLaunchStep(async function (context) {
    // So something before jasmine is launch and after istanbul is started
  })
  .withCleanUpStep(async function (context) {
    // Do some cleanup
  });

SimpleTestLauncher.execute(configBuilder.build());

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

Current Tags

23 Versions

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 373
Last Day 0
Last Week 0
Last Month 2
Dependencies (13)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |