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 🙏

© 2026 – Pkg Stats / Ryan Hefner

leyati

v1.0.2

Published

React component unit test script generator

Readme

Description

Inspector Leyati runs unit tests from templates for a collection of React components and saves the successful and retained into a final unit test script.

The location and name of a component are placed into given template that is saved as an "alpha test script". The tests in this script are run and those passed are written to a final test script. Failed tests are not written to the final test script unless they have the annotation @leyati-retain right above them.

Leyati uses babel, babylon, and Mocha.

Installation

npm install --save leyati

API

bin/leyati.js <command> (commands: "init")

bin/leyati.js <template file name> <test script destination> <source location> [component name]

  • Inspector

new Inspector(templateFilename, testsPath, componentName)

inspector.options(config)

The shape of config is as follows and can be found in config.js:

{
	createTestScriptEvenIfAllTestsFail: true,
	leaveAlphaTestScript: false,
	babelOptions: {...},
	babylonOptions: {...},
	mochaOptions: {...}
}

inspector.setConstant(name, value)

Set value for a placeholder that is found in given template by name.

inspector.on(eventType, fn)

Set callbacks for events. For now there is only one, "finalized", that is called after all tests in a script have been run and the final test script been written.

inspector.processTemplate()

Replaces placeholders in given template file with the given constants.

inspector.saveAlphaTestScript()

Saves the source code processed in processTemplate() as an alpha test script.

inspector.runTests()

Runs the tests in an alpha test script and saves the successful and retained into a final unit test script.

inspector.run()

Calls processTemplate(), saveAlphaTestScript(), and runTests().

  • LeyatiAnnotation

A singleton that provides all available Leyati annotations and a RegExp pattern for them.

Example

const Inspector = require("leyati").Inspector;
const inspector = new Inspector("tpl/essential.js.tpl", "tests", "Foo");
inspector.options({...});

inspector.setConstant("%COMPONENT_NAME%", "Foo");
inspector.setConstant("%COMPONENT_PATH%", "src/Foo.js");

inspector.run();

The placeholder format in the templates bundled with Leyati is "%PLACEHOLDER_NAME%", but Leyati accepts any format.

Remarks

Leyati/Inspector uses eshal to find out the names of exported components in an ES6 file so naming testable components is not necessary on the command line.

Output

Writes alpha and final test scripts. By default, an alpha test script is removed after a final test script is written.