npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ednaaaj/jira-test

v1.0.5

Published

CLI tool that connects Jira issues to automated tests and runs them locally

Readme

jira-test

Run your test files and automatically post coverage to Jira tickets.

A CLI tool that runs test files, collects coverage, and posts results directly to Jira tickets with beautiful formatted comments.

✨ Features

  • 🎯 File-Based Testing: Simply run jira-test MyComponent.test.tsx
  • 🔍 Auto-Detection: Automatically finds Jira ticket from describe blocks
  • 🧪 Test Runner Detection: Supports Jest, Vitest, Mocha (auto-detected from package.json)
  • 📊 Coverage Reporting: Posts component coverage directly to Jira tickets
  • 📋 Subtask Matching: Shows which Jira subtasks have tests in your file
  • 🎨 Beautiful Formatting: Rich Jira comments with tables, colors, and status badges
  • ⚡ Animated Spinners: Real-time progress indicators
  • 🔒 Flexible Auth: Supports Jira Cloud and Data Center/Server
  • 🚫 No Plugins: Works with standard Jira without Xray/Zephyr

📦 Installation

# Install globally
npm install -g @ednaaaj/jira-test

# Or use npx
npx @ednaaaj/jira-test MyComponent.test.tsx

🚀 Quick Start

1. Set up environment variables

# For Jira Cloud
export JIRA_BASE_URL="https://your-domain.atlassian.net"
export JIRA_EMAIL="[email protected]"
export JIRA_API_TOKEN="your-api-token"

# For Jira Data Center/Server
export JIRA_BASE_URL="https://jira.your-company.com"
export JIRA_PAT="your-personal-access-token"

Get your Jira API token: https://id.atlassian.com/manage-profile/security/api-tokens

2. Add Jira ticket to your test file

// HotelBanner.test.tsx
describe('HOTEL-27752', () => {
  it('renders banner correctly', () => {
    // your test
  });
});

3. Run the test

jira-test HotelBanner.test.tsx

That's it! The tool will:

  • ✅ Auto-detect the Jira ticket (HOTEL-27752) from your describe block
  • ✅ Auto-detect your test runner (Jest/Vitest/Mocha)
  • ✅ Run tests with coverage
  • ✅ Post results and coverage to HOTEL-27752

📖 Usage

File Mode (Recommended)

Run a specific test file:

jira-test path/to/MyComponent.test.tsx

The tool will:

  1. Find the Jira ticket key from describe('TICKET-123', ...) in your file
  2. Detect your test runner from package.json
  3. Run tests with coverage for that file only
  4. Fetch subtasks from Jira
  5. Post a comment to the Jira ticket with:
    • Test run summary (X tests ran, Y passed, Z failed)
    • Subtask matching table (which subtasks have tests in the file)
    • Component coverage table (coverage for the component being tested)

Options

jira-test MyComponent.test.tsx --no-comment  # Run without posting to Jira
jira-test MyComponent.test.tsx --dry         # Preview without running tests

What Gets Posted to Jira

When you run jira-test HotelBanner.test.tsx, it posts a comment like this:

🧪 Test Run Summary
12 tests ran — 12 passed · 0 failed

📋 Subtask Matching
┌──────────────┬─────────────────────────────────┬───────────────────┐
│ Subtask      │ Title                           │ Status            │
├──────────────┼─────────────────────────────────┼───────────────────┤
│ HOTEL-27988  │ Verify banner is displayed      │ ✅ Found in file  │
│ HOTEL-27989  │ Verify banner JSON structure    │ ⚠️ Not found      │
└──────────────┴─────────────────────────────────┴───────────────────┘

🎯 Component Coverage
┌──────────────────┬────────────┬──────────┬───────────┬───────┐
│ File             │ Statements │ Branches │ Functions │ Lines │
├──────────────────┼────────────┼──────────┼───────────┼───────┤
│ HotelBanner.tsx  │ 71.66%     │ 50%      │ 71.42%    │ 73.21%│
└──────────────────┴────────────┴──────────┴───────────┴───────┘

🔧 Advanced Usage

Legacy Mode (Run by Jira Key)

You can still run tests by Jira key directly:

jira-test run HOTEL-27752

This mode:

  • Fetches the ticket and subtasks from Jira
  • Runs all tests matching describe('HOTEL-27752', ...)
  • Posts coverage to the ticket

Options for Legacy Mode

| Option | Description | Default | |--------|-------------|---------| | --platform <web\|mobile\|all> | Filter test cases by platform label | all | | --link-type <name> | Jira link type for test case links | "is tested by" | | --mode <mode> | ticket-key or title matching | ticket-key | | --jest-cmd <command> | Test command to run | jest | | --repo <path> | Repository root path | current directory | | --no-comment | Disable posting to Jira | posts by default |

Examples

# File mode (recommended)
jira-test src/components/Button.test.tsx

# Run without posting to Jira
jira-test Button.test.tsx --no-comment

# Legacy mode - run by ticket key
jira-test run HOTEL-27752

# Legacy mode with custom Jest command
jira-test run HOTEL-27752 --jest-cmd "turbo test --filter=./packages/hotels --"

# Preview what would run
jira-test run HOTEL-27752 --dry

🎯 How It Works

File Mode Workflow

  1. Parse Test File: Extracts Jira ticket key from describe('TICKET-123', ...)
  2. Detect Test Runner: Checks package.json for jest/vitest/mocha
  3. Run Tests: Executes test file with coverage
  4. Fetch Jira Data: Gets ticket and subtasks from Jira API
  5. Match Subtasks: Compares Jira subtask titles with test names
  6. Filter Coverage: Shows only the component file being tested
  7. Post to Jira: Creates formatted comment with results and coverage

Auto-Detection

Test Runner Detection (checks package.json dependencies):

  • Jest: jest or @jest/core
  • Vitest: vitest
  • Mocha: mocha

Jira Ticket Detection (from describe blocks):

describe('TICKET-123', () => { ... })  // ✅ Detects TICKET-123
describe('HOTEL-456', () => { ... })   // ✅ Detects HOTEL-456

Coverage Filtering

The tool intelligently filters coverage to show only relevant files:

# Running: jira-test HotelBanner.test.tsx
# Shows coverage for: HotelBanner.tsx only
# Hides: All other project files

📋 Subtask Matching

The tool compares Jira subtasks with tests in your file:

| Subtask Title | Test Name | Status | |--------------|-----------|--------| | "Verify banner displays correctly" | it('Verify banner displays correctly', ...) | ✅ Found | | "Verify banner has 3 dots" | No matching test | ⚠️ Not found |

This helps you track which subtasks have test coverage!

🚨 Exit Codes

| Code | Meaning | |------|---------| | 0 | All tests passed | | 1 | One or more tests failed | | 2 | Configuration error (missing env vars, invalid file) | | 3 | Jira API error (auth failed, issue not found) |

🔐 Environment Variables

Required

  • JIRA_BASE_URL: Your Jira instance URL
    • Jira Cloud: https://your-domain.atlassian.net
    • Jira Server: https://jira.your-company.com

Authentication (choose one)

Jira Cloud:

export JIRA_EMAIL="[email protected]"
export JIRA_API_TOKEN="your-api-token"

Jira Data Center/Server:

export JIRA_PAT="your-personal-access-token"

🐛 Troubleshooting

"No Jira ticket found in test file"

Make sure your describe block includes a Jira ticket:

// ❌ Won't work
describe('HotelBanner tests', () => { ... })

// ✅ Works
describe('HOTEL-27752', () => { ... })

"Issue does not exist or you do not have permission"

  1. Check the ticket exists in Jira
  2. Verify your JIRA_BASE_URL is correct
  3. Ensure your API token/PAT is valid
  4. Confirm you have permission to view the ticket

"Coverage shows too many files"

This should be fixed automatically! The tool filters coverage to only show the component being tested. If you see too many files, please report an issue.

Tests run but no coverage shown

Make sure your Jest config has coverage enabled:

{
  "collectCoverageFrom": ["src/**/*.{ts,tsx}"]
}

🏗️ Development

# Clone the repo
git clone https://github.com/ednaaaj/jira-test.git
cd jira-test

# Install dependencies
npm install

# Build
npm run build

# Link for local testing
npm link

# Now you can run
jira-test path/to/your/test.tsx

🤝 Contributing

Contributions welcome! Please open an issue or PR.

📄 License

MIT

🙏 Credits

Built with ❤️ for developers who want automated test reporting in Jira without the overhead of expensive plugins.