Socket
Book a DemoInstallSign in
Socket

@funboxteam/frontend-tests-runner

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@funboxteam/frontend-tests-runner

A library for running Mocha tests in parallel

latest
Source
npmnpm
Version
5.0.0
Version published
Weekly downloads
2
Maintainers
4
Weekly downloads
 
Created
Source

@funboxteam/frontend-tests-runner

npm

A library for running Mocha tests in parallel and watching files changes in live mode.

По-русски

Installation

npm install --save-dev @funboxteam/frontend-tests-runner

Usage

Example of usage:

const config = {
  parallelTestsCount: 2,
  testFiles: './src/tests/e2e/*.js',
  project: {
    build() {
      // Build project function. Must return Promise.
    },
    addListener(event) {
      // Even subscription function. There're two possible events
      //   buildStart — the project building has started;
      //   buildFinish — the project building has finished;
      // Helpful for live testing.
    }
  }
};

const Runner = require('@funboxteam/frontend-tests-runner');
const runner = new Runner(config);
runner.start();

For more check examples directory.

Configuration

Example of all configuration options and their defaults:

module.exports = {
  // A number of files with tests running in parallel.
  // Optional.
  parallelTestsCount: 1,

  // Run tests in live mode (enabling watching for files changes).
  // Optional.
  live: false,

  // Write logs for each test file separately.
  // Optional.
  separatedLogs: false,

  // Directory name for `separatedLogs`.
  // Optional.
  logDir: 'test-logs',

  // Glob with tests files, for exampe: `tests/\*.js`.
  // Required.
  testFiles: undefined,

  // Return test files for run. Function can be async.
  // Optional.
  filterTestsFiles: (files, isFilteredByOnly) => {
    // e.g.:
    // if (isFilteredByOnly) return files;

    // const testsFilesDependencies = getTestsFilesDependencies(files);
    // const changedFiles = getChangedFiles();

    // return getAffectedTestsFiles(testsFilesDependencies, changedFiles);
  },

  project: {
    build() {
      // Build project function. Must return Promise.
    },
    addListener(event) {
      // Event subscription function. There're two possible events:
      //   buildStart — the project building has started;
      //   buildFinish — the project building has finished.
      // Helpful for live testing.
    }
  },

  // Mocha config https://mochajs.org/#command-line-usage.
  // Optional.
  mocha: {
    // Test timeout threshold (in milliseconds).
    // https://mochajs.org/#-timeout-ms-t-ms
    // Optional.
    timeout: 30000,

    // Retry failed tests this many times.
    // https://mochajs.org/#-retries-n
    // Optional.
    retries: 0,

    // Disable color output.
    // https://mochajs.org/#-color-c-colors
    // Optional.
    noColors: false,

    // Additional args object for Mocha.
    // Optional.
    args: {
      // e.g.:
      // '--full-trace': 'true',
      // '--require': [
      //   '@babel/register',
      //   'babel-polyfill',
      // ],
    },
  },
}

Sponsored by FunBox

FAQs

Package last updated on 16 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts