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

@dnslink/test

v0.11.1

Published

A programming-language independent test harness for DNSLink implementations.

Downloads

17

Readme

dnslink-test

A language independent test harness for DNSLink implementations such as dnslink-std/js or dnslink-std/go.

Installation

The tests are written in javascript and published through npm. This means for the execution of the tests Node.js is required.

You can run the tests "on-the-fly" using $ npx @dnslink/test or install them permanently using npm i @dnslink/test -g and then run it using $ dnslink-test.

Usage

To use this harness you need to prepare an executable, lets call it my-impl.

  1. my-impl needs to be able to process command line arguments. The first argument for my-impl is a domain name.
  2. Using the domain name as input, my-impl needs to output a JSON formatted object to stdout.
  3. The output needs to have a found object containing all the DNSLink entries found for a domain.
  4. Any found DNSLink entry needs to be returned in the found, like: { "links": { "foo": "bar" } }, if redirects happen with deep linking, the path property needs to be set like ..."path": [{ "pathname": "/dir/name", "search": { "foo": ["bar"] }}]
  5. Now you can run tests using dnslink-test -- my-impl and it will show whether or not your implementation passes.
  6. Optionally, your implementation may support standard log messages and/or codes for debugging why a DNSLink entry can not found. To enable this you need to also return a log object that contains all the log entries and run the tests with the --enable log flag: $ dnslink-test --enable log -- my-impl.
  7. While developing you can use --skip or --only to disable/enable specific tests in order to make development more comfortable.

The list of rules that an implementation needs to cover is defined in ./integration-tests.js.

Built-in DNS server

dnslink-test comes automatically with a DNS server that is run on the localhost's UDP and TCP ports, as well as a DNS-over-HTTPS compatible endpoint (thought it is a regular HTTP endpoint).

The implementation tested receives a second argument which contains a JSON object. Looking like this:

{
  "udp": 2345,
  "tcp": 2346,
  "doh": 2347,
  "flags": {}
}

The udp, tpc and doh numbers are ports on which the local server are listening for the duration of the tests. They contain the DNS TXT entries for all known domains.

Note: The flags objects contains any flags that you may have passed in.

One can also run the DNS server in a standalone mode (for debug, or in custom CI setups):

$ dnslink-test --server-only
{
  "udp": 49953,
  "tcp": 37755,
  "doh": 39427
}

License

Published under dual-license: MIT OR Apache-2.0