Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@diffblue/cover-client

Package Overview
Dependencies
Maintainers
5
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@diffblue/cover-client

Diffblue Cover client library - Node.js API for Diffblue Cover

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
increased by160%
Maintainers
5
Weekly downloads
 
Created
Source

Diffblue Cover client library - Node.js API for Diffblue Cover

The Diffblue Cover client library provides a programmatic interface and CLI for communicating with the Diffblue Cover API.

Installation

Using npm:

npm install @diffblue/cover-client

Usage

To use Diffblue Cover to run an analysis and produce test files you will need to provide a JAR file of your compiled code and the path to a directory where you want test files to be written.

In Node.js (using promises):

const Analysis = require('@diffblue/cover-client').Analysis;
const fs = require('fs');

const analysis = new Analysis('https://your-cover-api-domain.com');
const buildFile = fs.createReadStream('./build.jar');
// This is a sample settings object that will not run a useful analysis.
// You can omit the settings parameter when calling `run` to start an analysis with default settings.
const settings = { phases: { firstPhase: { timeout: 10 }}};
const options = { outputTests: './tests' };

analysis.run({ build: buildFile }, settings, options)
.then((results) => {
  console.log(`Analysis ended with the status: ${analysis.status}.`);
  console.log(`Produced ${results.length} tests in total.`);
  console.log(`Test files written to ${options.outputTests}.`);
});

In Typescript (using async/await):

import Analysis from '@diffblue/cover-client';
import { createReadStream } from 'fs';

const analysis = new Analysis('https://your-cover-api-domain.com');
const buildFile = createReadStream('./build.jar');
// This is a sample settings object that will not run a useful analysis.
// You can omit the settings parameter when calling `run` to start an analysis with default settings.
const settings = { phases: { firstPhase: { timeout: 10 }}};
const options = { outputTests: './tests' };

(async () => {
  const results = await analysis.run({ build: buildFile }, settings, options);
  console.log(`Analysis ended with the status: ${analysis.status}.`);
  console.log(`Produced ${results.length} tests in total.`);
  console.log(`Test files written to ${options.outputTests}.`);
})();

For more detailed usage, see the programmatic interface documentation.

Full documentation

Copyright 2019 Diffblue Limited. All Rights Reserved.

FAQs

Package last updated on 22 Nov 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc