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

spectator

v0.0.4

Published

Spector.JS allows you to write all your specs inside normal JS files.

Readme

#Spectator.js

###what is it? Spectator is a grunt plugin which lets your add test-comments to your JS code and generates spec files for those tests.

###why should i use it?

	<li>Save time and effort : Spectator makes it easier to create and maintain your project's unit testing code.</li>
<li>Improve readability : Spectator will greatly improve code readability since the tests are included side-by-side real code, along with suite and individual test descriptions.</li>
<li>Ensure testability : Spectator makes it easy to examine your code and find places where unit tests are missing or insufficient.</li>

<li>HTML Spec Runner : Spectator will be happy to carve-out an html spec-runner page of the type you specify - supported types currently include Jasmine, Mocha and QUnit.</li>
	<li>Syntax : Use any assertion syntax you like, we don't judge - we just render! if you wish to use the HTML spec runner generated, a valid type needs to be specified per file.</li>

###how does it work? Spectator is a grunt plugin, that takes the path for the relevant JS files, processes them, and creates test files inside a default, or specific location.

###let's get busy: ###1: Spectator syntax lives inside JS comments, and is recognised by the delimiter '@#' For a basic unit test , one would simply write:

(a.js)

/* 
	@# describe("A suite", function() {
	@#   it("contains spec with an expectation", function() {
	@#  	expect(true).toBe(true);
	@#   });
	@# });
*/
function foo()
{
	return bar;
}

to render the following spec file.

(aSpec.js)

describe("A suite", function() {
  it("contains spec with an expectation", function() {
    expect(true).toBe(true);
  });
});

pretty simple, huh?

###2: Specific file name and path for output can be specified:

(a.js)

//@# file:'/someDir/someSpec.js'
//@#...

(/someDir/someSpec.js])

...

###3: Spectator syntax can be placed anywhere inside the JS file, which can improve readability!

(a.js)

function doSomething()
{
	//Tests:
	//@# describe('A suite', function(){ 
	//@# 	it('initially, flag should be false', function(){
	//@# 		expect(flag).toBe(false);
	//@#	}
	
	doSomething();
	
	//@# 	it("doSomething should change flag to true", function() {
	//@# 		doSomething()
	//@# 		expect(flag).toBe(true);
	//@# 	}
	//@# }

 }

(aSpec.js)

describe("A suite", function() {

  it("initially, flag should be false", function() {
	expect(flag).toBe(false);
  });

  it("doSomething should change flag to true", function() {
	 doSomething();
	 expect(flag).toBe(true);
  });
  
});

###4: Spectator can automagically create your dedicated spec runner file, which will contain the files you've specified and the specs that were created for them. to use this feature, init the tasks config in the following way: (gruntfile.js)

grunt.initConfig({
        // Configuration to be run (and then tested).
        Spectator: {
            files: ['test/fixtures/*.js'],
            options: {
                output_dir: 'test/Spectator/',
                test_runner: {
                    enabled: true,
                    version: '2.1.3',
                    type: 'jasmine',
                    folder: [output folder for the spec runner]
                }
            }
        }
});

###Spectator will do the rest to serve a fully functional specRunner. (Work in progress)...

###5: Want to add comments to your spec? no sweat!

(a.js)

/* 
   @# describe('A suite', function(){ 
   @# 	// COMMENTS COMMENTS COMMENTS
   @# 	it('contains spec with an expectation', function(){
   @# 		expect(true).toBe(true);
   @# 	}
   @# });
*/