{"id":23318865,"url":"https://github.com/ts-graphviz/jest-graphviz","last_synced_at":"2026-01-05T01:45:16.161Z","repository":{"id":37830916,"uuid":"220763940","full_name":"ts-graphviz/jest-graphviz","owner":"ts-graphviz","description":"🃏 A plugin for jest that supports graphviz integration.","archived":false,"fork":false,"pushed_at":"2024-01-18T02:37:57.000Z","size":557,"stargazers_count":3,"open_issues_count":27,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T20:21:26.691Z","etag":null,"topics":["graphviz","graphviz-dot","jest","jest-plugin","testing","testing-library","typescript-library"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jest-graphviz","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ts-graphviz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"ts-graphviz","patreon":null,"open_collective":"ts-graphviz","ko_fi":null,"tidelift":"npm/ts-graphviz","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-11-10T08:47:53.000Z","updated_at":"2023-07-19T06:05:08.000Z","dependencies_parsed_at":"2024-04-18T08:04:15.907Z","dependency_job_id":null,"html_url":"https://github.com/ts-graphviz/jest-graphviz","commit_stats":{"total_commits":75,"total_committers":3,"mean_commits":25.0,"dds":"0.41333333333333333","last_synced_commit":"565d341061ebac2c60b100a8ebb0a06f7eec0d06"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ts-graphviz%2Fjest-graphviz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ts-graphviz%2Fjest-graphviz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ts-graphviz%2Fjest-graphviz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ts-graphviz%2Fjest-graphviz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ts-graphviz","download_url":"https://codeload.github.com/ts-graphviz/jest-graphviz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230319230,"owners_count":18207942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphviz","graphviz-dot","jest","jest-plugin","testing","testing-library","typescript-library"],"created_at":"2024-12-20T17:19:52.922Z","updated_at":"2026-01-05T01:45:16.115Z","avatar_url":"https://github.com/ts-graphviz.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ts-graphviz","https://opencollective.com/ts-graphviz","https://tidelift.com/funding/github/npm/ts-graphviz","https://ko-fi.com/W7W5VDNO"],"categories":[],"sub_categories":[],"readme":"[![GitHub Action](https://github.com/kamiazya/jest-graphviz/workflows/NodeCI/badge.svg)](https://github.com/kamiazya/jest-graphviz/actions?workflow=NodeCI) [![npm version](https://badge.fury.io/js/jest-graphviz.svg)](https://badge.fury.io/js/jest-graphviz) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Test Coverage](https://api.codeclimate.com/v1/badges/b5856ac3f3ced5b64a05/test_coverage)](https://codeclimate.com/github/kamiazya/jest-graphviz/test_coverage)\n\n# jest-graphviz\n\nA plugin for [jest](https://jestjs.io/) that supports [graphviz](https://graphviz.gitlab.io/) integration.\n\n## Installation\n\nThe plugin can then be installed using [npm](https://www.npmjs.com/):\n\n[![NPM](https://nodei.co/npm/jest-graphviz.png)](https://nodei.co/npm/jest-graphviz/)\n\n### yarn\n\n```bash\nyarn add -D jest-graphviz\n```\n\n### npm\n\n```bash\nnpm install --save-dev jest-graphviz\n```\n\n## Configuration\n\nImport `jest-graphviz` with the script specified in [`setupFilesAfterEnv`](https://jestjs.io/docs/en/configuration#setupfilesafterenv-array).\n\n### Example\n\n#### `jest.config.js`\n\n```javascript\nmodule.exports = {\n  preset: 'ts-jest',\n  testEnvironment: 'node',\n  verbose: true,\n  collectCoverage: true,\n  setupFilesAfterEnv: [\n    // Add this.\n    '\u003crootDir\u003e/config/jest/setup-jest.ts',\n  ],\n};\n```\n\n#### `config/jest/setup-jest.ts`\n\n```typescript\nimport 'jest-graphviz';\n```\n\n## Requirement\n\nThis extension requires Graphviz.\nIf you don't have it installed, install it here[here](https://graphviz.gitlab.io/download/).\n\n## Usage\n\n### `toBeValidDot`\n\n```typescript\ndescribe('toBeValidDot test', () =\u003e {\n  it('matcher works', () =\u003e {\n    const dot = 'digraph g { a -\u003e b; }';\n    expect(dot).toBeValidDot();\n  });\n\n  it('invalid dot', () =\u003e {\n    const dot = 'invalid';\n    expect(dot).not.toBeValidDot();\n  });\n});\n```\n\n### `toBeValidDotAndMatchSnapshot`\n\n```typescript\ndescribe('toBeValidDotAndMatchSnapshot test', () =\u003e {\n  test('matcher works', () =\u003e {\n    const dot = 'digraph g { a -\u003e b; }';\n    expect(dot).toBeValidDotAndMatchSnapshot();\n  });\n});\n```\n\n### `toMatchDotJsonSnapshot`\n\n```typescript\ndescribe('toMatchDotJsonSnapshot test', () =\u003e {\n  test('matcher works', () =\u003e {\n    const dot = 'digraph g { a -\u003e b; }';\n    expect(dot).toMatchDotJsonSnapshot();\n  });\n});\n```\n\n\u003e It depends on the JSON output format added in Graphviz 2.40.0.\n\n## See Also\n\nGraphviz-dot Test and Integration\n\n- [ts-graphviz](https://github.com/ts-graphviz/ts-graphviz)\n  - Graphviz library for TypeScript.\n- [@ts-graphviz/react](https://github.com/ts-graphviz/react)\n  - Graphviz-dot Renderer for React.\n- [setup-graphviz](https://github.com/ts-graphviz/setup-graphviz)\n  - GitHub Action to set up Graphviz cross-platform(Linux, macOS, Windows).\n\n## License\n\nThis software is released under the MIT License, see LICENSE.\n\n## Author\n\n[kamiazya(Yuki Yamazaki)](https://github.com/kamiazya)\n\n[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/W7W5VDNO)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fts-graphviz%2Fjest-graphviz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fts-graphviz%2Fjest-graphviz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fts-graphviz%2Fjest-graphviz/lists"}