{"_rev":"6-193a16b7e8dab2aedb99ef834660da83","time":{"created":"2025-10-21T16:37:29.153Z","modified":"2025-10-21T16:37:29.724Z","0.1.0":"2025-10-13T21:44:56.260Z","1.0.0":"2025-10-13T22:13:54.640Z","1.0.1":"2025-10-21T16:37:29.427Z"},"_id":"@bouaiche/vitest-discord-reporter","name":"@bouaiche/vitest-discord-reporter","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"@bouaiche/vitest-discord-reporter","version":"1.0.1","description":"A Vitest reporter that sends test results to a Discord channel via embeds","keywords":["vitest","reporter","discord","ci","testing"],"type":"module","license":"MIT","author":{"name":"Mounir Bouaiche","email":"mounir.bouaiche.dev@gmail.com"},"homepage":"https://github.com/b-mounir-dev/vitest-discord-reporter","bugs":{"url":"https://github.com/b-mounir-dev/vitest-discord-reporter/issues"},"repository":{"type":"git","url":"git+https://github.com/b-mounir-dev/vitest-discord-reporter.git"},"engines":{"node":">=18"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"publishConfig":{"access":"public"},"scripts":{"prepare":"husky","prebuild":"rimraf dist","build":"tsdown","dev":"tsdown --watch","format":"prettier --write .","format:check":"prettier --check .","lint":"eslint","lint:fix":"eslint --fix","test:run":"vitest run","test":"vitest","typecheck":"tsc --noEmit","release":"bumpp && npm publish"},"dependencies":{"undici":"^7.16.0"},"devDependencies":{"@types/node":"^22.0.0","@typescript-eslint/eslint-plugin":"^8.46.0","@typescript-eslint/parser":"^8.46.0","bumpp":"^10.1.0","discord.js":"^14.22.1","eslint":"^9.37.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","husky":"^9.1.7","prettier":"^3.6.2","rimraf":"^6.0.1","tsdown":"^0.15.6","typescript":"^5.9.3"},"peerDependencies":{"vitest":">=3.0.0"},"gitHead":"9e46f69fdfdd03f46da83a9841c0c83aa4d9a88a","_id":"@bouaiche/vitest-discord-reporter@1.0.1","_nodeVersion":"22.20.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-rHy+bsIoTsWxaBCYotsPRHZmeotfaYmm3AFN8CVSZ6HoJjHTfz5SsCANUMRZ3TpuvpxwytMStaDESfbBjoU50Q==","shasum":"478fdc1b565eba2d843125b2715f102ef359cfd5","tarball":"https://registry.npmjs.org/@bouaiche/vitest-discord-reporter/-/vitest-discord-reporter-1.0.1.tgz","fileCount":7,"unpackedSize":20546,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDgMpBWbp0VRikOgGs2uTY5Qwz1BnsVFW3u3QhKFeqI5AIgDgCTIVEtstKy+bv4+X/cbbUKva3rRXnA10rnctNVvNk="}]},"_npmUser":{"name":"mounirbouaiche","email":"mounir.bouaiche.dev@gmail.com"},"directories":{},"maintainers":[{"name":"mounirbouaiche","email":"mounir.bouaiche.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vitest-discord-reporter_1.0.1_1761064649222_0.5126680677075675"},"_hasShrinkwrap":false}},"maintainers":[{"name":"mounirbouaiche","email":"mounir.bouaiche.dev@gmail.com"}],"description":"A Vitest reporter that sends test results to a Discord channel via embeds","homepage":"https://github.com/b-mounir-dev/vitest-discord-reporter","keywords":["vitest","reporter","discord","ci","testing"],"repository":{"type":"git","url":"git+https://github.com/b-mounir-dev/vitest-discord-reporter.git"},"author":{"name":"Mounir Bouaiche","email":"mounir.bouaiche.dev@gmail.com"},"bugs":{"url":"https://github.com/b-mounir-dev/vitest-discord-reporter/issues"},"license":"MIT","readme":"# vitest-discord-reporter\n\nA Vitest reporter that sends test results to a Discord channel via embeds.\n\n- Summary, passed/failed/skipped/total, and duration\n- Optional mention when failures occur\n- Optional stack traces in failure details\n- Configurable inclusion of passed tests\n\n## Install\n\n- npm: `npm i -D @bouaiche/vitest-discord-reporter`\n- yarn: `yarn add -D @bouaiche/vitest-discord-reporter`\n- pnpm: `pnpm add -D @bouaiche/vitest-discord-reporter`\n\n## Quick start\n\n1) Create a Discord webhook (Server Settings → Integrations → Webhooks) and copy the URL.\n2) Expose it as an env var (recommended) and configure the reporter.\n\nvitest.config.ts:\n\n```ts\nimport { defineConfig } from 'vitest/config';\nimport { DiscordReporter } from '@bouaiche/vitest-discord-reporter';\n\nexport default defineConfig({\n  test: {\n    reporters: [\n      'default',\n      new DiscordReporter({\n        // Prefer set VITE_DISCORD_REPORTER_WEBHOOK_URL in .env.test var to avoid committing secrets\n        webhookUrl: 'https://discord.com/api/webhooks/<channel_id>/<token>',\n        title: 'Test Results',\n        includeStackTrace: false,\n        mentionOnFailure: '',\n        showPassedTests: true,\n      }),\n    ],\n  },\n});\n```\n\n.env (or .env.test):\n```\nVITE_DISCORD_REPORTER_WEBHOOK_URL=https://discord.com/api/webhooks/<channel_id>/<token>\n```\n\npackage.json:\n```json\n{\n  \"scripts\": {\n    \"test:run\": \"vitest run\"\n  }\n}\n```\n\n## Options\n\n- webhookUrl (string): Discord webhook URL.\n- title (string, default: \"Test Results\"): Title of the summary embed.\n- includeStackTrace (boolean, default: false): Include stack traces for failed tests (truncated to fit Discord limits).\n- mentionOnFailure (string, default: \"\"): A string added to the summary embed when there are failures (e.g. `<@1234567890>` or `@team`).\n- showPassedTests (boolean, default: true): Include an embed listing passed tests.\n\n## What gets sent\n\n- Summary embed with counts for passed/failed/skipped/total and total duration.\n- Failed tests embed: up to 10 failed tests (names and errors). Long names and errors are truncated.\n- Passed tests embed: up to 20 passed tests. Long lists are truncated.\n\nNote: Discord enforces size limits on embeds. This reporter truncates fields to avoid rejections.\n\nMentions: Whether a mention actually pings depends on your webhook and server mention settings.\n\n## CI example (GitHub Actions)\n\n```yaml\nname: CI\non: [push, pull_request]\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 22\n      - run: npm ci\n      - run: npm run build --if-present\n      - run: npx vitest run\n        env:\n          VITE_DISCORD_REPORTER_WEBHOOK_URL: ${{ secrets.CI_DISCORD_WEBHOOK_URL }}\n```\n\n## Local testing\n\n- Set `VITE_DISCORD_REPORTER_WEBHOOK_URL` in your environment or `.env`\n- Run: `npm run test:run` or `npx vitest run`\n\n## Development\n\n- Build: `npm run build`\n- Lint: `npm run lint` / `npm run lint:fix`\n- Format: `npm run format` / `npm run format:check`\n- Tests: `npm run test` or `npm run test:run`\n\n## License\n\nMIT © Mounir Bouaiche\n","readmeFilename":"README.md"}