Skip to content

Commit

Permalink
change tap to nodeunit and add test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
clux committed Jul 10, 2014
1 parent ce38c45 commit 57207dc
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
node_modules/
node_modules
lib-cov/
1 change: 0 additions & 1 deletion .npmignore

This file was deleted.

5 changes: 4 additions & 1 deletion .travis.yml
@@ -1,6 +1,9 @@
language: node_js
node_js:
- 0.8
- 0.10

notifications:
email: true

after_script:
- npm run coveralls
4 changes: 4 additions & 0 deletions History.md → CHANGELOG.md
@@ -1,3 +1,7 @@
0.2.1 / 2014-07-10
==================
* Documentation and coverage maintenance release

0.2.0 / 2012-10.19
==================
* Defer to `Number.isFinite` and `Number.isNaN` (removes node 0.6 support)
Expand Down
8 changes: 5 additions & 3 deletions README.md
@@ -1,7 +1,9 @@
# typr
[![Build Status](https://secure.travis-ci.org/clux/typr.png)](http://travis-ci.org/clux/typr)
[![Dependency Status](https://david-dm.org/clux/typr.png)](https://david-dm.org/clux/typr)
[![frozen](http://hughsk.github.io/stability-badges/dist/frozen.svg)](http://nodejs.org/api/documentation.html#documentation_stability_index)
[![npm status](http://img.shields.io/npm/v/typr.svg)](https://www.npmjs.org/package/typr)
[![build status](https://secure.travis-ci.org/clux/typr.svg)](http://travis-ci.org/clux/typr)
[![dependency status](https://david-dm.org/clux/typr.svg)](https://david-dm.org/clux/typr)
[![coverage status](http://img.shields.io/coveralls/clux/typr.svg)](https://coveralls.io/r/clux/typr)
[![frozen](http://img.shields.io/badge/stability-frozen-33C614.svg)](http://nodejs.org/api/documentation.html#documentation_stability_index)

## Mutually Exclusive JS Type Testring
The aim of this module is to completely partition the set of JS objects into a set of types T:
Expand Down
3 changes: 3 additions & 0 deletions index.js
@@ -0,0 +1,3 @@
module.exports = process.env.TYPR_COV
? require('./lib-cov/typr.js')
: require('./lib/typr.js');
File renamed without changes.
11 changes: 8 additions & 3 deletions package.json
Expand Up @@ -3,19 +3,24 @@
"name": "typr",
"description": "Mutually exclusive type testing",
"version": "0.2.0",
"stability": "frozen",
"repository": {
"type": "git",
"url": "clux/typr"
},
"main": "typr.js",
"engines": {
"node": ">=0.8"
},
"main": "index.js",
"scripts": {
"test": "tap ./test"
"test": "$(npm bin)/nodeunit --reporter=verbose test/*.js",
"coveralls": "$(npm bin)/jscoverage lib && TYPR_COV=1 $(npm bin)/nodeunit --reporter=lcov test | $(npm bin)/coveralls"
},
"dependencies": {},
"devDependencies": {
"tap": "~0.4.4"
"nodeunit": "~0.9.0",
"jscoverage": "~0.5.4",
"coveralls": "~2.11.1"
},
"bugs": {
"url": "http://github.com/clux/typr/issues"
Expand Down
16 changes: 7 additions & 9 deletions test/partition.js
@@ -1,6 +1,4 @@
var tap = require('tap')
, test = tap.test
, t = require('../typr.js')
var t = require('../')
, F = function () {};

// this kind of case is slightly problematic
Expand All @@ -11,7 +9,7 @@ twoThing.prop = "hello";
var twoThing2 = new String("wee");
twoThing2.prop = "hi";

test('hasKeys', function (a) {
exports.hasKeys = function (a) {
a.ok(t.hasKeys(twoThing), "function has keys");
a.ok(t.hasKeys(twoThing2), "new String has keys");
a.ok(!t.hasKeys(5), "number still isn't object like'");
Expand All @@ -27,8 +25,8 @@ test('hasKeys', function (a) {
a.ok(Object.keys(el), "if hasKeys, keys work..");
};
});
a.end();
});
a.done();
};

// We expect the that the following arrays can be partitioned as follows
var expected = {
Expand All @@ -45,7 +43,7 @@ var expected = {
, 'Arguments' : [ arguments ]
};

test('type partitioning', function (a) {
exports.partitioning = function (a) {
a.ok(t.isFunction, 't.isFunction exists');

Object.keys(expected).forEach(function (type) {
Expand Down Expand Up @@ -107,5 +105,5 @@ test('type partitioning', function (a) {
// isInfinite should fail for a Number and NaN
a.ok(!t.isInfinite(NaN), "NaN is not Infinite");
a.ok(!t.isInfinite(5), "5 is not Infinite");
a.end();
});
a.done();
};

0 comments on commit 57207dc

Please sign in to comment.