{"id":13377,"library":"jest-markdown-expand-reporter","title":"Jest Markdown Expand Reporter","description":"jest-markdown-expand-reporter is a Jest test reporter that generates detailed test reports in Markdown format. Currently in version 0.1.2-beta, it focuses on providing highly readable and actionable test summaries. Its release cadence appears iterative, driven by beta versions and feature enhancements. Key differentiators include the ability to create expandable sections for individual test results, capture and display per-test console logs (debug, info, error, log, warn), and robust integration with CI/CD pipelines. It supports outputting reports to environment variables using file locking for safe concurrent writes and can generate GitHub Actions workflow annotations for failed tests, significantly improving failure visibility in CI environments. Unlike simpler reporters, it's designed to provide a comprehensive, navigable report suitable for both local review and automated workflows.","status":"active","version":"0.1.2-beta","language":"javascript","source_language":"en","source_url":"https://github.com/SamSike/jest-markdown-expand-reporter","tags":["javascript","jest","jest-reporter","markdown","typescript","report","testing","logs"],"install":[{"cmd":"npm install jest-markdown-expand-reporter","lang":"bash","label":"npm"},{"cmd":"yarn add jest-markdown-expand-reporter","lang":"bash","label":"yarn"},{"cmd":"pnpm add jest-markdown-expand-reporter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This package is a Jest reporter and requires Jest as a peer dependency to function. It integrates directly with Jest's test runner.","package":"jest","optional":false}],"imports":[{"note":"When configuring in `jest.config.js` or `package.json`, the reporter is specified as a string name. If you need to pass options, it must be an array where the first element is the string name and the second is an options object.","wrong":"\"jest-markdown-expand-reporter\"","symbol":"Jest Reporter Configuration","correct":"[\"jest-markdown-expand-reporter\", { /* options */ }]"},{"note":"This path is used in `setupFilesAfterEnv` to patch Jest's console object, enabling the reporter to capture and display console logs for each test. Forgetting the `dist/` subdirectory is a common oversight.","wrong":"jest-markdown-expand-reporter/patchConsole.js","symbol":"Console Patch Utility","correct":"jest-markdown-expand-reporter/dist/patchConsole.js"}],"quickstart":{"code":"{\n  \"jest\": {\n    // To capture console logs in the output\n    \"setupFilesAfterEnv\": [\"jest-markdown-expand-reporter/dist/patchConsole.js\"],\n    \"reporters\": [\n      [\n        \"jest-markdown-expand-reporter\",\n        {\n          \"filename\": \"test-report.md\",\n          \"publicPath\": \"./test-reports\",\n          \"displayAll\": true,\n          \"failureMessages\": true,\n          \"consoleLogs\": [\"all\"], // Can be ['log', 'error', 'warn', 'info', 'debug'] or ['all']\n          \"ciOutput\": [\"GITHUB_STEP_SUMMARY\"], // e.g., for GitHub Actions step summary\n          \"enableAnnotations\": true, // Enables GitHub Actions annotations for failures\n          \"skipDisplayIfNoFailures\": true,\n          \"prioritizeFailures\": true\n        }\n      ]\n    ]\n  }\n}","lang":"json","description":"This configuration snippet for `jest.config.js` demonstrates how to integrate the reporter, patch the console for log capture, and configure various reporting options including output filename, console log types, CI integration, and GitHub annotations."},"warnings":[{"fix":"Always pin to exact versions or test thoroughly when updating within the 0.x.x range.","message":"The package is currently in a beta version (0.1.2-beta). Future releases, even minor ones, may introduce breaking changes or significant API adjustments before a stable 1.0.0 release.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Add `\"setupFilesAfterEnv\": [\"jest-markdown-expand-reporter/dist/patchConsole.js\"]` to your Jest configuration.","message":"For console logs to be captured and displayed in the report, you MUST include `jest-markdown-expand-reporter/dist/patchConsole.js` in your `setupFilesAfterEnv` configuration array.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Verify that your CI workflow's environment variables are correctly named and accessible, and that the `ciOutput` array in your Jest config matches these names (e.g., `['GITHUB_STEP_SUMMARY']`).","message":"When using `ciOutput`, the reporter writes to specified environment variables (e.g., `GITHUB_STEP_SUMMARY`). Ensure the CI environment allows writing to these variables and that the specified environment variables exist and are correctly configured for your CI provider.","severity":"gotcha","affected_versions":">=0.0.4"},{"fix":"Ensure your tests are running in a GitHub Actions workflow for annotations to appear. Disable `enableAnnotations` if not in GitHub Actions to avoid unnecessary processing.","message":"The `enableAnnotations` option only functions within GitHub Actions workflows. Enabling it in other CI environments or locally will have no effect on output annotations.","severity":"gotcha","affected_versions":">=0.1.0-beta"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Run `npm install jest-markdown-expand-reporter` or `yarn add jest-markdown-expand-reporter`. Double-check the spelling in your Jest configuration.","cause":"The reporter package is not installed, or there's a typo in the reporter name in `jest.config.js`.","error":"Error: Reporter 'jest-markdown-expand-reporter' not found."},{"fix":"Add `\"setupFilesAfterEnv\": [\"jest-markdown-expand-reporter/dist/patchConsole.js\"]` to your `jest.config.js` or `package.json` Jest configuration.","cause":"The `patchConsole.js` setup file, which is responsible for intercepting console calls, has not been included in Jest's `setupFilesAfterEnv`.","error":"Console logs are not appearing in the report despite setting `consoleLogs` to 'all'."},{"fix":"Ensure your CI environment variable (e.g., `GITHUB_STEP_SUMMARY`) is correctly configured and writable. Verify the `ciOutput` option in your Jest config precisely matches the environment variable's name. Check CI job logs for any file locking errors.","cause":"This could happen if file locking failed or the CI environment variable isn't correctly configured to receive output.","error":"My `ciOutput` environment variable is empty or contains an old report after a new run."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}