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

suitest

v0.1.0

Published

Suitest is a powerful and easy-to-use JavaScript BDD test suite

Downloads

30

Readme

Suitest

Suitest provides easy unit testing for JavaScript code

  • Very simple to use
  • Client-side and server-side (including NodeJS) support
  • One of the most lightweightest libraries for unit testing
  • Support for working with asynchronous code
  • Outline function callbacks!
  • Fluent interface support (chaining)

##Synopsis:

.test( name, callback, [, context ] );
.exec( x, [, y, context ] );
.done( [ name ] );
.text( description );
.stop();
.get();
.is();

Screenshot

Suitest

.test ( name, callback, [, context ] );

var unit = new Suitest;

unit.test('test name', function(unit) {
	unit.exec(true, 1); // true
	unit.done();
});

.exec ( x, [, y, context ] );

Using with one parameter:

unit.exec(true); // true

Using with two parameter:

unit.exec(true, 1); // true, because default operation is ==

Using with three parameters:

unit.exec(true, 1, '==='); // false, because true and 1 are not equivalent

.done ( [ name ] );

Simple using:

unit.done();

Testing asynchronous code:

unit.test('test name', function(unit) {
	setTimeout(function() {
		unit.exec(true, 1); // true
		unit.done();
	}, 2000);
});

.text ( description );

unit.text('Test description');

.stop ();

unit.stop();

.is ()

unit.exec(true, 1);
unit.is(); // true

.get ( name );

Outline function callback

var set = function() {
	return unit
		.get('test 6')
		.exec(true, 1)
		.done();
};

Simple using

unit.test('test', function(unit) {
	set(); // true
});

Using with asynchronous code

unit.test('test', function(unit) {
	setTimeout(set, 2000); // true
});

Function.prototype.bind / Function.prototype.call Also you can use it without <get> method (but this not recommended):

var set = function() {
	return this
		.exec(true, 1)
		.done();
};

unit.test('test', function(unit) {
	set.call(this); // true
});

Chaining (Fluent interface)

var unit = new Suitest;

unit
.test('test 1', function(unit) {
	unit.exec(true, 1).done();
})

.test('test 2', function(unit) {
	unit.text('test description').exec(true, 1).done();
})

.test('test 2', function(unit) {
	if (!unit.exec(true, 1).is())
		unit.stop();
});

##.

  • License Suitest is licensed under the MIT (MIT_LICENSE.txt) license

  • Copyright (c) 2012 [Alexander Guinness] (https://github.com/monolithed)