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

jasmine-browser

v0.0.12

Published

A jasmine plugin running in browser

Downloads

120

Readme

jasmine-browser

This is one tiny implementation of jasmine, which is runnable in the browser environment. I create this tiny rudimentary 'jasmine framework' basically for fun and to have a jasmine runnable in browser with the minimum codes that I can write.

Usage

By now, you should, however, only deploy it under the browser environment(for the name) and might refer to your old friend JavaScript DevTools Console(i.e., F12 in some browsers) to observe the resulting record.

describe("Testing", function() {
	var share;
	
	beforeEach("BeforeEach: Sharing Value", function() {
		share = 18;
		expect(share).toBe(0);
	});

	it("the first: Synchronousity", function() {
		var num = 1;
		expect(share++).toBe(18);
		expect(num).toBe(1);
	});

	it("the second: Asynchronousity", function(done) {
		var called = false;
		setTimeout(function() {
			called = true;
			expect(share).toBe(18);
			expect(called).toBe(false);
			done();
		}, 0);
		expect(called).toBe(false);
	});

	it("the third: Object", function() {
		var arr = {a:1, b:2};
		expect(arr).toEqual({a:1, b:3, c:5});
	});
	

	// createSpy & toHaveBeenCalledWith is in development

});

Features

This module is developed orginally for fun & exploration, hence the features are quite limited initially, but it will be improved in the future. The current features include:

  • basic support of describe, expect & it, just like jasmine.
  • support the asynchronous test.

There are no supports of gulp, webpack or browserify yet right now, but still they are on schedule. One more thing, another brother module is about crafting on schedule, i.e., jasmine-node, the one which can test in node.js environment which uses the node module process.nextTick for a pollyfill.

Finally, while I have not sketched out the other API akin to original 'jasmine' at a higher level yet, you should be awared that they atually exsit and will be brought out in the future. What the codes I write down here are only a demonstration of showing how short and runable codes I can write for one humble mimic of jasmine. Just feel feel to learn the details and issue the problem of the codes. There are certain more features comming out near future, features like createSpy, toHaveBeenCalled and toHaveBeenCalledWith are all on schedule to be released.

There are even another brother module ongoing I write about, namely jasmine-node, the one which can test in node.js environment which uses the node module process.nextTick for a pollyfill.

For now, suffice it to merely enjoy the poor interface I have implemented.

Stay tuned~