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

jest-graphviz

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-graphviz

A plugin for jest that supports graphviz integration.

  • 0.5.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

GitHub Action npm version License: MIT code style: prettier Test Coverage

jest-graphviz

A plugin for jest that supports graphviz integration.

Installation

The plugin can then be installed using npm:

NPM

yarn

yarn add -D jest-graphviz

npm

npm install --save-dev jest-graphviz

Configuration

Import jest-graphviz with the script specified in setupFilesAfterEnv.

Example

jest.config.js
module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  verbose: true,
  collectCoverage: true,
  setupFilesAfterEnv: [
    // Add this.
    '<rootDir>/config/jest/setup-jest.ts',
  ],
};
config/jest/setup-jest.ts
import 'jest-graphviz';

Requirement

This extension requires Graphviz. If you don't have it installed, install it herehere.

Usage

toBeValidDot

describe('toBeValidDot test', () => {
  it('matcher works', () => {
    const dot = 'digraph g { a -> b; }';
    expect(dot).toBeValidDot();
  });

  it('invalid dot', () => {
    const dot = 'invalid';
    expect(dot).not.toBeValidDot();
  });
});

toBeValidDotAndMatchSnapshot

describe('toBeValidDotAndMatchSnapshot test', () => {
  test('matcher works', () => {
    const dot = 'digraph g { a -> b; }';
    expect(dot).toBeValidDotAndMatchSnapshot();
  });
});

toMatchDotJsonSnapshot

describe('toMatchDotJsonSnapshot test', () => {
  test('matcher works', () => {
    const dot = 'digraph g { a -> b; }';
    expect(dot).toMatchDotJsonSnapshot();
  });
});

It depends on the JSON output format added in Graphviz 2.40.0.

See Also

Graphviz-dot Test and Integration

  • ts-graphviz
    • Graphviz library for TypeScript.
  • @ts-graphviz/react
    • Graphviz-dot Renderer for React.
  • setup-graphviz
    • GitHub Action to set up Graphviz cross-platform(Linux, macOS, Windows).

License

This software is released under the MIT License, see LICENSE.

Author

kamiazya(Yuki Yamazaki)

ko-fi

Keywords

FAQs

Package last updated on 23 Sep 2021

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