slack-ctrf is an open-source, community-driven JavaScript/TypeScript library designed to send comprehensive test results to Slack channels. It supports the Common Test Report Format (CTRF) to ensure compatibility across various testing frameworks. The package, currently at version 0.0.31, is under active development, as indicated by frequent, small releases adding new features like AI summaries, custom titles, and glob patterns for report processing. Key differentiators include its deep integration with the CTRF ecosystem, support for detailed reports including failed and flaky test analyses, AI-generated summaries, and flexible templating for custom Slack messages. It aims to streamline CI/CD pipelines by providing conditional notifications, such as sending alerts only when tests fail, and supports both Slack Incoming Webhooks and OAuth Tokens for authentication.
npm install slack-ctrfVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to programmatically send a Slack notification with test results from a CTRF report using environment variables for authentication.
Always pin to a specific patch version (e.g., `~0.0.31` or exact `0.0.31`) and review release notes for each update. Consider using `npm ci` for consistent builds.
Ensure your Node.js environment is updated to at least version 20.19.0. Use `nvm` or your preferred Node.js version manager to switch versions.
Always use environment variables (`process.env.SLACK_WEBHOOK_URL`), secret management systems in CI/CD, or secure configuration files. Avoid committing secrets directly to repositories.
Regularly consult the Slack API Changelog and developer documentation for updates. When building custom messages, prioritize Block Kit for future compatibility.
Set the `SLACK_WEBHOOK_URL` environment variable, or if using OAuth, set both `SLACK_OAUTH_TOKEN` and `SLACK_CHANNEL_ID` before running the command or script. Alternatively, pass them via CLI flags like `--webhook-url`.
Verify that the path to your CTRF report (`--file` option or programmatic `file` property) is correct and the file exists. Ensure the process has read permissions for the file.
Go to your Slack App settings, navigate to 'OAuth & Permissions', and ensure the 'chat:write' scope is added to your bot token. Reinstall the app to your workspace if scopes were changed.
Validate your CTRF report using `ctrf` package's validation utilities (e.g., `validateStrict` from `ctrf`). Ensure the report contains the required `summary` and `results` fields.
No dependency data recorded yet.