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

test-bridge

v0.1.3

Published

A tool to connect your automated test runs with your test repository.

Downloads

9

Readme

test-bridge

Connect your automated test runs with your test repository.

This script will parse a report generated by a local execution of your tests, and publish results to your test repository. When included in your CI build, every time you push to, e.g., your release branch, this script will update the respective test case runs in your test management tool.

Example

$ karma # Run your unit tests to generate your report
$ test-bridge --reporter karmaJson --management testlodge --testRun NextRelease

This will parse the report generated by karma, and update all related test cases for the specified test run ("NextRelease") in your test management tool.

Supported reporters and test management tools

CI support

  • Codeship
  • Travis CI (PR welcome!)

Reporters

Test management tools

  • TestLodge

How does this work

Reporter plugins

Reporter plugins process results from local test executions. They will typically parse a report and search for test cases that are linked with your test repository. Tests in code are linked with test cases in your repository by searching for occurrences of a certain pattern. For instance, a test case like this

describe('Array', function() {
  describe('#indexOf()', function () {
    it('should return -1 when the value is not present #TC02', function () {
      assert.equal(-1, [1,2,3].indexOf(5));
      assert.equal(-1, [1,2,3].indexOf(0));
    });
  });
});

will update a test case labeled TC02 in your test management tool.

CI Plugins

When test-bridge is included in your CI builds, it can retrieve information about the current build using CI plugins. For instance, when using git-flow, you can configure test-bridge to only update test results for commits on the release branch. You can tell test-bridge on which branches to trigger by specifiying a regex pattern. This will also be used to determine the name of the test run to be updated in your test management tool. The default pattern that will be used is https://regex101.com/r/kS8bR1/1.

For example,

# CI triggered on branch 'release/v0.5.0'
$ test-bridge --reporter karmaJson --management testlodge --ci codeship --extractTestRunFromBranchName
# test-bridge will update the test run named 'v0.5.0' in TestLodge

extracts the test run name that will be passed to testlodge later on, using the current branch.

Test management tool plugins

Test management tool plugins take the result from reporter plugins and update all test case runs with the results of the latest test execution.

Command line usage

$ test-bridge --help

  Usage: test-bridge [options]

  Options:

    -h, --help                                    output usage information
    -V, --version                                 output the version number
    -c, --ci <pluginName>                         The CI plugin to use
    -r, --reporter <pluginName>                   The reporter plugin to use
    -m, --management <pluginName>                 The management plugin to use
    -t, --testRun <identifier>                    The test run to be updated by the management plugin
    -e, --extractTestRunFromBranchName [pattern]  Extract test run pattern from branch name. Optionall extraction regex. Only available with a CI plugin.
    -v, --verbose                                 Verbose logging

Configuration

test-bridge requires a filed named .testbridgerc in the root directory. This file can be used to pass additional configuration to plugins that can't be set via command line arguments. If you are using test-bridge via it's API, you have to pass options to test-bridge's main function.

Environment variable placeholders

If you don't want to commit .testbridgerc to your source control while holding account details for your test management tool, you can use placeholders that will be subsituted at runtime. E.g., in the following .testbridgerc

{
  "managementOptions": {
    "name": "myProject",
    "project": "12345",
    "email": "${TESTLODGE_LOGIN_EMAIL}",
    "password": "${TESTLODGE_LOGIN_PASSWORD}",
  }
}

${TESTLODGE_LOGIN_EMAIL} as well as ${TESTLODGE_LOGIN_PASSWORD} will be replaced by the respective environment variables.

Grunt & Gulp

If you want to include test-bridge to your existing build tool, you can just write a simple task that makes a call to test-bridge's API. I already started writing a grunt task.