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

hermione-url-decorator

v1.0.2

Published

Plugin for hermione which adds additional params to current browser url

Downloads

8

Readme

hermione-url-decorator

Build Status Coverage Status

Plugin for hermione which is intended to change test urls in runtime. You can read more about plugins at documentation.

Installation

npm install hermione-url-decorator

Usage

Configuration

  • enabled (optional) Boolean – enable/disable the plugin; by default plugin is enabled
  • url (optional) Object - the list of url parameters, which will be added in each test url
    • query (optional) Object - the list of query parameters
      • queryParam (optional) Object - name of query parameter
        • value (optional) String - value of query parameter
        • concat (optional) Boolean - enable/disable concatenation; by default is true

Examples

Add plugin to your hermione config file:

module.exports = {
    // ...

    plugins: {
        'hermione-url-decorator': true
    },

    // ...
};

To pass additional url parameters you can use environment variables, which should start with HERMIONE_URL_ or specify them in the hermione config file.

For example, you have the following test url: http://localhost/test/?name=hermione and you want to add query parameter via environment variable:

HERMIONE_URL_QUERY_TEXT=ololo hermione

After that your test url will be changed to: http://localhost/test/?name=hermione&text=ololo.

The same thing you can do using hermione config file:

'hermione-url-decorator': {
    url: {
        query: {
            text: {
                value: 'ololo'
            }
            // or
            text: 'ololo'
        }
    }
}

Note: environment variables have higher priority than config values.

Concatenation of url parameters

In previous example you have seen how add url parameters. Now we look how to concat and override url parameters.

Suppose, you want to add query parameter name which is already presented in your test url: http://localhost/test/?name=hermione and you don't want to override it:

'hermione-url-decorator': {
    url: {
        query: {
            name: {
                value: 'harry',
                concat: true
            }
            // or
            name: {
                value: 'harry'
            }
            // or
            name: 'harry'
        }
    }
}

The result url will look like: http://localhost/test/?name=hermione&name=harry. How you understand, the result will be the same if concat would be any value except false.

Moreover for previous test url you can specify a set of values for one query parameter:

'hermione-url-decorator': {
    url: {
        query: {
            name: {
                value: ['hermione', 'ron']
            }
            // or
            name: [
                'harry',
                'ron'
            ]
        }
    }
}

The result url will look like: http://localhost/test/?name=hermione&name=harry&name=ron

If you want to override value of name query parameter:

'hermione-url-decorator': {
    url: {
        query: {
            name: {
                value: 'harry',
                concat: false
            }
        }
    }
}

As a result url will look like: http://localhost/test/?name=harry.

You can do the same thing via environment variables. In this case concat value will be used from config to the same url parameter:

HERMIONE_URL_QUERY_NAME=ron hermione

The result url will look like: http://localhost/test/?name=ron