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

investigatr

v0.1.1

Published

investigatr is a minimal, extensible JavaScript test framework

Downloads

3

Readme

investigatr

investigatr is a minimal, extensible JavaScript test framework that runs in the browser (node support coming soon). The main aim of investigatr is to allow testing without modification of existing code and fast setup of tests.

Basic Usage

First, install investigatr

npm install investigatr

Next, create my.spec.js and myTestRunner.html in the cloned folder. Our file structure will look like:

investigatr
  - node_odules
  - my.spec.js
  - myTestRunner.html
// my.spec.js
testGroup('Test Group Name', {
    data: {},
    tests: {
        "verify investigatr is working": function (data) {
            assertEquals(1, 1);
        },
    }
});
<!-- myTestRunner.html-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>investigatr test suite</title>
</head>

<body>
    <div class="investigatr">

    </div>
    <script src="./node_modules/investigatr/dist/investigatr.js"></script>
    <script src="./my.spec.js"></script>
    <script>
        investigatr.run();
    </script>
</body>

</html>

Open mytestRunner.html in a browser and you should see your test passing. For a more complicated example view the spec files in the tests folder.

By default investigatr outputs the results to a div element with the class of investigatr.

testGroup options

data | object | required

the data that should be set at the start of every test

tests | object | required

an object containing all the tests for this group. Keys are the test names and values should be functions.

tests: {
    "test name": function() {
        assertEquals(1,1);
    }
}

beforeEach | function(data) | optional

function to call before every test. Can be used to set up data etc.

investigatr options

investigatr allows options to be set with the init method.

example:

investigatr.init({
    output: false;
})

output | boolean

if output is set to false the render method on the renderer will not be called

renderer | instance of a class that implements a render method

Renderer is how the results will be renderer. It should be an instance of a class that implements a render method.

Extending investigatr

coming soon

Contributing

Running the tests

To run the tests simply clone this repository and open tests/testRunner.html. The tests use investigatr as a test framework.

License

This project is licensed under the MIT License - see the LICENSE.md file for details