ESDoc2 Integrate Test Plugin

2.0.0 · active · verified Sun Apr 19

This package, `esdoc2-integrate-test-plugin`, functions as a specialized plugin for the ESDoc2 documentation generator. Its primary purpose is to seamlessly embed and link integration test documentation directly into the output generated by ESDoc2. Users configure the plugin within their `esdoc2` setup to specify the source directories containing test files, define recognized testing interfaces (such as `describe`, `it`, `context`, `suite`, and `test`), and apply include/exclude regex patterns to precisely control which test files are processed. The plugin is currently on version 2.0.0, with a recent feature release (v2.1.0) indicating ongoing maintenance and development. Its key differentiator lies in enabling comprehensive documentation that cross-references code with its corresponding integration tests, enhancing clarity for maintainers and consumers of the documented codebase. The release cadence appears feature-driven, providing updates as new capabilities are added or existing ones are refined.

Common errors

Warnings

Install

Quickstart

This configuration snippet shows how to integrate `esdoc2-integrate-test-plugin` into your ESDoc2 documentation generation process by specifying test file locations, testing interfaces, and regex patterns for including/excluding files.

// esdoc.config.js
/**
 * @type {import('esdoc2').Config}
 */
module.exports = {
  // Source directory for your main application code
  source: './src',
  // Destination directory for the generated documentation
  destination: './docs',
  // Array of plugins to extend ESDoc2's functionality
  plugins: [
    {
      // Name of the integration test plugin
      name: 'esdoc2-integrate-test-plugin',
      // Options specific to this plugin
      option: {
        // Source directory for your integration test files
        source: './test/',
        // List of global test interfaces to recognize and link (e.g., from Mocha, Jest)
        interfaces: ['describe', 'it', 'context', 'suite', 'test'],
        // Regex patterns to include specific test files
        includes: ['(spec|Spec|test|Test)\\.js$', '(integration|e2e)\\.ts$'],
        // Regex patterns to exclude specific test files (e.g., configuration files)
        excludes: ['\\.config\\.js$', '\\.fixture\\.js$']
      }
    }
  ]
};

// To run this configuration, save it as `esdoc.config.js` in your project root
// and execute: `npx esdoc2` in your terminal.

view raw JSON →