Permalink
Browse files

Add generation of instrumented code files by `istanbul`; refactor `vo…

…ws` tests to use instrumented files on `COVER=1` environment variable
  • Loading branch information...
arikon committed Oct 28, 2012
1 parent 26d03e6 commit d2c1b75d5efcccff12534e4450980a15fefcf0e4
Showing with 27 additions and 7 deletions.
  1. +2 −1 .gitignore
  2. +16 −3 GNUmakefile
  3. +1 −0 index.js
  4. +4 −0 lib/{coa.js → index.js}
  5. +0 −1 package.json
  6. +0 −1 src/coa.coffee
  7. +3 −0 src/index.coffee
  8. +1 −1 test/shell-test.js
View
@@ -1,3 +1,4 @@
.idea
*.iml
-node_modules
+node_modules/
+lib-cov/
View
@@ -1,15 +1,28 @@
+BIN = ./node_modules/.bin
+
.PHONY: all
all: lib
lib: $(foreach s,$(wildcard src/*.coffee),$(patsubst src/%.coffee,lib/%.js,$s))
+lib-cov: lib
+ $(BIN)/istanbul instrument --output lib-cov --no-compact --variable global.__coverage__ lib
+
lib/%.js: src/%.coffee
- ./node_modules/.bin/coffee -cb -o $(@D) $<
+ $(BIN)/coffee -cb -o $(@D) $<
.PHONY: test
test: lib
- ./node_modules/.bin/vows --spec
+ $(BIN)/vows --spec
+
+.PHONY: coverage
+coverage: lib-cov
+ COVER=1 $(BIN)/vows --spec
.PHONY: watch
watch:
- coffee --watch --bare --output lib src/*.coffee
+ $(BIN)/coffee --watch --bare --output lib src/*.coffee
+
+.PHONY: clean
+clean:
+ -rm -rf lib-cov
View
@@ -0,0 +1 @@
+module.exports = require(process.env.COVER? './lib-cov' : './lib');

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -18,7 +18,6 @@
"directories": {
"lib": "./lib"
},
- "main": "./lib/coa.js",
"dependencies": {
"q": "~0.8.8"
},
View
@@ -1 +0,0 @@
-exports.Cmd = require('./cmd').Cmd
View
@@ -0,0 +1,3 @@
+exports.Cmd = require('./cmd').Cmd
+exports.shell = require('./shell')
+exports.require = require;
View
@@ -1,6 +1,6 @@
var vows = require('vows'),
assert = require('assert'),
- shell = require('../lib/shell');
+ shell = require('..').shell;
vows.describe('coa/shell').addBatch({

0 comments on commit d2c1b75

Please sign in to comment.