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

@aspecto/cli

v0.1.19

Published

Aspecto CLI

Downloads

100

Readme


What is Aspecto?

Aspecto is the CLI test runner of Aspecto.
You can integrate it in your CI, git hooks or just run it manually.
The CLI will generate a test suite from Aspecto server, based on real data that was collected and prepared beforehand.
The generated suite will be run against a url you will provide, could be localhost, staging, production or anything else.

Installation

In your project, run:

yarn add @aspecto/cli --dev

You can now run aspecto-cli from your package.json scrips, like this:

...
scripts: {
    "aspecto:test": "aspecto test <url> [options]"
}
...

Alternatively, you can install @aspecto/cli globally and use it from the terminal from wherever you'd like.

Usage

aspecto test <URL> [options]

URL

The url you'd like Aspecto CLI to run the generated tests against.
Usually, you'd point this on your localhost when testing locally or to your staging url when running on your CI.

CLI Options

--package <packageName>

Alias -p. This will tell our servers to generate the tests based on which data that was collected beforehand.
It will usually be the name in your service package.json.
If you don't provide this option, we will try to get the name from the package.json ourselves.

--token <token>

Alias -t. Your authentication token, provided at https://app.aspecto.io/app/integration.
If non provided, we'll try to get it ourselves from the ASPECTO_TOKEN env param (process.env.ASPECTO_TOKEN).

--env <envs>

Alias -e. A csv of envs.
This will tell our servers to generate the tests based on data collected in the provided environments.
By default, we will create tests based on data from all environments.

Example: --env production,staging

--allow-methods <methods>

Alias -m. A csv of http methods. This will tell our servers to generate the tests based on data collected from routes meeting the allowed methods.
By default, we will create tests based on all http methods.

Example: --allow-methods POST,PUT

--allow-codes <codes>

Alias -c. A csv of http status codes. This will tell our servers to generate the tests based on data collected from responses with status code meeting the allowed codes.
By default, we will create tests based on all status codes.

Example: --allow-codes 200,204

--allow-fail

Alias -a. Use this flag to make the process quit with 1 when failing.
By default, the process will quit with 0.

--fail-strategy <soft|strict>

Alias -f. Relevant only when using --allow-fail.
Soft will fail the process only on a failed test.
Strict will fail the process on any kind of failure (i.e. bad usage, failure to fetch tests).

--timeout <timeout>

Alias -o. How long to wait (in milliseconds) before timing out an API call as part of the test suites. Default is 5000ms.

--test-param <param>

Alias -r. Supply parameters to populate data in tests which were configured accordingly in Aspecto tests section.
This enables you to alter certain parts of the request to match your specific testing setup.

You can define the parameter and it's value:

--test-param KEY1=value1 --test-param KEY2=value2

If not provided, we will try to pick it from your environment.

--verbose

Alias -v. Use this flag to print debug logs.

Examples

  $ aspecto test http://localhost:3322 --package my-service --token **** --allow-fail --env development -c 200,404 -m GET
  $ aspecto test https://staging.aspecto.com --env staging -a --verbose
  $ aspecto test https://prod.aspecto.com --allow-codes 200,204,500