
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@endbug/jest-pr-reporter
Advanced tools
An opinionated Jest reporter meant for GitHub Actions & PRs
An opinionated Jest reporter that creates GitHub PR comments with test results.
npm install @endbug/jest-pr-reporter
# or
yarn add @endbug/jest-pr-reporter
Add the reporter to your Jest configuration:
// jest.config.js
module.exports = {
reporters: [
"default",
[
"@endbug/jest-pr-reporter",
{
githubToken: process.env.GITHUB_TOKEN,
owner: process.env.GITHUB_REPOSITORY_OWNER,
repo:
process.env.GITHUB_REPOSITORY &&
process.env.GITHUB_REPOSITORY.split("/")[1],
prNumber: Number(process.env.PR_NUMBER), // Set this in your workflow or pass as env
sha: process.env.GITHUB_SHA,
workspace: process.env.GITHUB_WORKSPACE, // optional
workflowRunId: process.env.GITHUB_RUN_ID,
jobName: process.env.GITHUB_JOB,
footerSuccess: "🎉 All tests passed!",
footerFailed: "❌ Please fix the failing tests.",
hideProjectTag: false, // optional, defaults to false
failOnError: false, // optional, defaults to false
},
],
],
};
Option | Type | Required | Description |
---|---|---|---|
githubToken | string | ✅ | GitHub personal access token or GitHub App token |
owner | string | ✅ | GitHub repository owner (username or organization) |
repo | string | ✅ | GitHub repository name |
prNumber | number | ✅ | Pull request number |
sha | string | ✅ | Commit SHA for linking to specific files |
workflowRunId | string | ✅ | GitHub workflow run ID for linking to the specific run |
jobName | string | ✅ | GitHub job name (numeric ID is automatically extracted) |
workspace | string | ❌ | Workspace path for normalizing test file paths |
footerSuccess | string | ❌ | Custom footer text when tests pass |
footerFailed | string | ❌ | Custom footer text when tests fail |
hideProjectTag | boolean | ❌ | Whether to hide the project attribution tag |
failOnError | boolean | ❌ | Whether to fail the build if comment creation fails |
header | string | ❌ | Custom string to append to the HTML comment header |
// jest.config.js
module.exports = {
reporters: [
"default",
[
"@endbug/jest-pr-reporter",
{
githubToken: process.env.GITHUB_TOKEN,
owner: "EndBug",
repo: "jest-pr-reporter",
prNumber: 1,
sha: process.env.GITHUB_SHA,
workflowRunId: process.env.GITHUB_RUN_ID,
jobName: process.env.GITHUB_JOB,
},
],
],
};
// jest.config.js
module.exports = {
reporters: [
"default",
[
"@endbug/jest-pr-reporter",
{
githubToken: process.env.GITHUB_TOKEN,
owner: "EndBug",
repo: "jest-pr-reporter",
prNumber: 1,
sha: process.env.GITHUB_SHA,
workflowRunId: process.env.GITHUB_RUN_ID,
jobName: process.env.GITHUB_JOB,
footerSuccess: "🎉 Tests are passing! You can merge this PR.",
footerFailed:
"❌ Please review and fix the failing tests before merging.",
},
],
],
};
// jest.config.js
module.exports = {
reporters: [
"default",
[
"@endbug/jest-pr-reporter",
{
githubToken: process.env.GITHUB_TOKEN,
owner: "EndBug",
repo: "jest-pr-reporter",
prNumber: 1,
sha: process.env.GITHUB_SHA,
workflowRunId: process.env.GITHUB_RUN_ID,
jobName: process.env.GITHUB_JOB,
header: "my-tests", // Results in: <!-- Sticky Pull Request Comment jest-pr-reporter: my-tests -->
},
],
],
};
For more complex setups, you can separate the reporter options and use environment variables:
// jest.config.js
/** @type {import('@endbug/jest-pr-reporter').ReporterOptions} */
const reporterOptions = {
githubToken: process.env.GH_TOKEN,
owner: process.env.GITHUB_REPOSITORY_OWNER,
repo:
process.env.GITHUB_REPOSITORY &&
process.env.GITHUB_REPOSITORY.split("/")[1],
prNumber: Number(process.env.PR_NUMBER),
sha: process.env.GITHUB_SHA,
workspace: process.env.GITHUB_WORKSPACE,
workflowRunId: process.env.GITHUB_RUN_ID,
jobName: process.env.GITHUB_JOB,
header: "jest-tests",
footerFailed: `## 🛠️ Next Steps
1. **Review** the failing tests above
2. **Fix** your files so that the tests pass
3. **Push changes** and ensure CI passes
> [!TIP]
> Need help? Check the [README](https://github.com/campus-experts/campus-experts.github.io#readme) or ask in the Discord.
`.trim(),
};
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
reporters:
process.env.CI === "true"
? [["@endbug/jest-pr-reporter", reporterOptions], "summary"]
: ["default"],
};
# .github/workflows/test.yml
name: Tests
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: npm ci
- run: npm test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
Check the examples/
directory for more detailed examples:
jest-config-example.js
- JavaScript configuration with environment variablesjest-config-example.ts
- TypeScript configuration with proper typingusing-metadata.test.ts
- Examples of using metadata in testsmetadata-merging.test.ts
- Examples of metadata inheritance and mergingThe reporter:
MIT
FAQs
An opinionated Jest reporter meant for GitHub Actions & PRs
The npm package @endbug/jest-pr-reporter receives a total of 10 weekly downloads. As such, @endbug/jest-pr-reporter popularity was classified as not popular.
We found that @endbug/jest-pr-reporter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.