{"id":14106,"library":"teams-ctrf","title":"Microsoft Teams Test Reporter for CTRF","description":"teams-ctrf is a utility designed to send structured test result notifications to Microsoft Teams channels, adhering to the Common Test Report Format (CTRF) specification. This package allows teams to automate the reporting of test execution outcomes, including summaries, detailed reports, and flaky test detection, directly into their Teams environment. It is currently in active development, with version `0.0.6` being the stable release, and `0.0.7-next` actively introducing new features and refinements. The project is part of the broader CTRF ecosystem, which aims to standardize test reporting across various testing frameworks and programming languages, providing a unified JSON format for consistent analysis and comparison. It stands out by integrating directly with the CTRF standard, offering both command-line and programmatic interfaces for flexible deployment in CI/CD pipelines.","status":"active","version":"0.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/ctrf-io/microsoft-teams-test-reporter","tags":["javascript","typescript"],"install":[{"cmd":"npm install teams-ctrf","lang":"bash","label":"npm"},{"cmd":"yarn add teams-ctrf","lang":"bash","label":"yarn"},{"cmd":"pnpm add teams-ctrf","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the Common Test Report Format (CTRF) specification and utilities for report processing.","package":"ctrf","optional":false}],"imports":[{"note":"This is the primary function for sending a basic test results message to Teams. Primarily designed for ESM, but CJS can access via `.default` or property access.","wrong":"const sendTeamsMessage = require('teams-ctrf').sendTeamsMessage;","symbol":"sendTeamsMessage","correct":"import { sendTeamsMessage } from 'teams-ctrf';"},{"note":"Use this function to send a more richly formatted Adaptive Card based on CTRF data. Adaptive Cards offer greater flexibility in layout and interactive elements.","wrong":"import sendAdaptiveCard from 'teams-ctrf/adaptive-card';","symbol":"sendAdaptiveCard","correct":"import { sendAdaptiveCard } from 'teams-ctrf';"},{"note":"The package offers a robust CLI for direct usage in CI/CD. Programmatic access to CLI functions is not directly exposed for import.","wrong":"import { cli } from 'teams-ctrf';","symbol":"cli","correct":"npx teams-ctrf results /path/to/ctrf-report.json"}],"quickstart":{"code":"import { sendAdaptiveCard } from 'teams-ctrf';\n\nconst sampleCtrfReport = {\n  id: 'report-123',\n  name: 'Example Test Run',\n  description: 'A sample CTRF report for quickstart.',\n  results: {\n    summary: {\n      tests: 10,\n      passed: 7,\n      failed: 3,\n      skipped: 0,\n      pending: 0,\n      other: 0,\n      duration: 120000 // milliseconds\n    },\n    testSuites: [\n      {\n        id: 'suite-1',\n        name: 'Authentication Tests',\n        tests: [\n          { id: 'test-1', name: 'Login with valid credentials', status: 'passed', duration: 1000 },\n          { id: 'test-2', name: 'Login with invalid credentials', status: 'failed', duration: 500 }\n        ]\n      }\n    ]\n  },\n  metadata: {\n    timestamp: new Date().toISOString()\n  }\n};\n\nconst teamsWebhookUrl = process.env.TEAMS_WEBHOOK_URL ?? '';\n\nif (!teamsWebhookUrl) {\n  console.error('TEAMS_WEBHOOK_URL environment variable is not set.');\n  process.exit(1);\n}\n\nasync function sendReportToTeams() {\n  try {\n    console.log('Sending Adaptive Card report to Teams...');\n    await sendAdaptiveCard(teamsWebhookUrl, sampleCtrfReport);\n    console.log('Adaptive Card report sent successfully!');\n  } catch (error) {\n    console.error('Failed to send Adaptive Card report:', error.message);\n    process.exit(1);\n  }\n}\n\nsendReportToTeams();","lang":"typescript","description":"Demonstrates how to programmatically send a CTRF report as an Adaptive Card to Microsoft Teams using a webhook URL."},"warnings":[{"fix":"Review the updated API for programmatic message sending. If custom message formats were used, they might need to be refactored to align with the new Adaptive Card structure or utilize the dedicated `sendAdaptiveCard` function for richer formatting. The CLI might also have new options like `--useAdaptiveCard`.","message":"The `0.0.7-next-4` release notes mention a \"migration from Message\". This indicates a significant change in how messages are structured and sent, potentially impacting users relying on previous default message formats or direct message object construction. Users upgrading to `0.0.7` (or newer `next` versions) should review the latest documentation for changes in message payload or the introduction of Adaptive Cards as a preferred format.","severity":"breaking","affected_versions":">=0.0.7-next"},{"fix":"Ensure the `TEAMS_WEBHOOK_URL` environment variable (or directly provided URL) is correctly configured in your Microsoft Teams channel settings. Verify it's an 'Incoming Webhook' connector and has not been revoked. Test the webhook using a simple `curl` command if issues persist.","message":"Properly setting up a Microsoft Teams Incoming Webhook URL is crucial. Incorrect URLs or those lacking appropriate permissions will result in delivery failures without clear error messages from Teams itself.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'0.0.6':66 '0.0.7':72 'across':95 'activ':62,74 'adher':24 'aim':90 'allow':35 'analysi':109 'autom':38 'broader':86 'channel':23 'ci/cd':134 'command':125 'command-lin':124 'common':27 'comparison':111 'consist':108 'ctrf':6,9,31,87,120 'current':60 'deploy':132 'design':13 'detail':47 'detect':52 'develop':63 'direct':53,117 'ecosystem':88 'environ':57 'execut':43 'featur':77 'flaki':50 'flexibl':131 'format':30,106 'framework':98 'includ':45 'integr':116 'interfac':129 'introduc':75 'javascript':136 'json':105 'languag':101 'line':126 'microsoft':1,21 'new':76 'next':73 'notif':19 'offer':122 'outcom':44 'packag':34 'part':83 'pipelin':135 'program':100 'programmat':128 'project':81 'provid':102 'refin':79 'releas':70 'report':4,29,40,48,94 'result':18 'send':15 'specif':32 'stabl':69 'stand':113 'standard':92,121 'structur':16 'summari':46 'team':2,8,22,36,56 'teams-ctrf':7 'test':3,17,28,42,51,93,97 'typescript':137 'unifi':104 'util':12 'various':96 'version':65","created_at":"2026-04-20T01:57:58.223269+00:00","updated_at":"2026-04-20T01:57:58.223269+00:00","problems":[{"fix":"Double-check the `TEAMS_WEBHOOK_URL` for typos. Ensure your CI/CD environment or local machine has outbound internet access to the Teams webhook endpoint. Regenerate the webhook URL in Teams if necessary.","cause":"The provided Microsoft Teams webhook URL is either malformed, expired, or the system attempting to send the message has no network access to it.","error":"Error: Failed to send message to Teams: Invalid webhook URL or network error."},{"fix":"Validate your CTRF report JSON against the CTRF schema. If customizing the Adaptive Card, ensure its JSON structure is valid according to the Adaptive Cards schema (schema.adaptivecards.io). Minor differences in required fields or data types can cause this error.","cause":"The CTRF report JSON or the Adaptive Card payload generated from it is malformed or does not adhere to the expected schema by Microsoft Teams.","error":"Failed to send Adaptive Card report: Error: Response status: 400. Response body: Bad payload"},{"fix":"Set the `TEAMS_WEBHOOK_URL` environment variable in your shell or CI/CD pipeline configuration. For example: `export TEAMS_WEBHOOK_URL='https://hooks.teams.com/services/your/webhook/url'` (replace with your actual URL).","cause":"The required environment variable `TEAMS_WEBHOOK_URL` was not found during execution, which is necessary for the library to know where to send messages.","error":"TEAMS_WEBHOOK_URL environment variable is not set."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"teams-ctrf","cli_version":null,"type":"library","homepage":"https://ctrf.io","github":"https://github.com/ctrf-io/microsoft-teams-test-reporter","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/teams-ctrf","openapi_spec":null,"status_page":null,"smithery":null,"categories":["communication","devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}