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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@taskworld.com/tw-test-indexer

v0.1.0

Published

Index test reports (JUnit, Allure) to AWS Elasticsearch

Downloads

5

Readme

test-indexer

A simple script to index Allure XML test results to Elasticsearch. This allows us to analyze our test results across multiple projects and builds.

Problem to solve

Some of our tests are flaky, and we mostly dealt with it by rebuilding and hope that it will pass. Because of this, our automated tests which should make us faster makes us slower instead. When multiple tests are flaky and/or slow, it quickly becomes frustrating (e.g. today I fix this flaky test, the next day another test fails). It’s hard to know which action to take that will make the most impact.

The first step towards resolving this is to gain visibility into our testing process, so that we can answer key questions like:

  • Which flaky tests should we fix to have the most positive impact on build success rate?
  • Which test should we optimize to have the most impact on reducing our build time?

The indexing process

  1. When tests are run, a results file is generated (Allure XML files).

  2. We use allure-commandline to generate an HTML report. Inside the generated HTML reports are JSON files.

  3. We read these JSON files (which represents each test case) and index them into Elasticsearch.

Running the tool

npx @taskworld.com/tw-test-indexer \
  --project=tw-test-indexer \
  --category=unit-tests \
  --branch="$(git rev-parse --abbrev-ref HEAD)" \
  --commit="$(git rev-parse HEAD)" \
  --buildNumber="$CIRCLE_BUILD_NUM" \
  --output="/tmp/result.ndjson"
  path/to/results/directory ...

This will save a file at /tmp/result.ndjson which contains the NDJSON payload suitable for sending to Elasticsearch’s Bulk API.

Publishing to npm

npm version X.Y.Z && git push --follow-tags && npm publish

Setting up an index

PUT /testcases
{
  "mappings": {
    "_doc": {
      "properties": {
        "uid": {"type": "keyword"},
        "name": {"type": "text"},
        "status": {"type": "keyword"},
        "project": {"type": "keyword"},
        "branch": {"type": "keyword"},
        "commit": {"type": "keyword"},
        "category": {"type": "keyword"},
        "buildNumber": {"type": "integer"},
        "time": {
          "properties": {
            "start": {"type": "date"},
            "stop": {"type": "date"},
            "duration": {"type": "integer"}
          }
        }
      }
    }
  }
}