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

@space-labs/osnap

v1.6.1

Published

The speedy and easy to use snapshot testing tool for your project!

Downloads

114

Readme

Table of contents

How do I install it?

Docker (recommended)

Use one of the official Docker images at https://hub.docker.com/u/osnap.

NOTICE: We do recommend using a Docker Container to run the tests, because snapshot tests are by nature pretty susceptible to the smallest changes in rendering. The biggest problem is, that Browsers render (mainly fonts and images) differently on different devices and operating systems. For the human eye, this is mostly not noticeable, but for an diffing algorithm, these changes are noticeable and will fail the test. So it is important to always run the tests in the same environment.

npm / yarn

OSnap may be installed with yarn or npm using one of the following commands:

yarn add @space-labs/osnap --dev

or

npm install @space-labs/osnap --save-dev

How do I use it?

Before you can run your first test suite, OSnap needs to be configured. To do this, you need at least two files. The global config file and one test file.

After you have created them you have to run yarn osnap, npx osnap or create a npm script running osnap with the optional cli flags available.

In in-depth documentation with configuration options and examples can be found at:

https://ewert-online.github.io/OSnap

Credits

ODiff: ODiff inspired the name of this library and is used as the underlying diffing algorithm. Thank you for your work @dmtrKovalenko!

Contributing

Contributions are always welcome. Here's how to set up the project locally.

Install opam

https://opam.ocaml.org/doc/Install.html

Install dependencies

make install

Build the project

make

Some things we may want to add:

In decending order of priority (top ones are more important):

  • [ ] A built in static webserver: The speed of the server used to serve the website being tested influences the speed of OSnap a lot. So we want to control that a bit more and provide a built in static web server. This also makes it easier to run tests, as you don't have to explicitly wait for the server to be up and running before running osnap.
  • [ ] Listen for network requests: Wait for specific network requests to finish, before taking the screenshot. For example: Wait for a failed login attempt to come back, to screenshot the error state
  • [ ] Wait for dom events: Maybe we can find a way, to wait for specific events to be triggered on the page. For example: Wait for all animations on the page to complete before taking the screenshot.

If you find a bug or think some feature is missing, feel free to submit an issue :)