Skip to content

Commit

Permalink
Add generation of instrumented code files by istanbul; refactor `vo…
Browse files Browse the repository at this point in the history
…ws` tests to use instrumented files on `COVER=1` environment variable
  • Loading branch information
arikon committed Oct 28, 2012
1 parent 26d03e6 commit d2c1b75
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
*.iml
node_modules
node_modules/
lib-cov/
19 changes: 16 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require(process.env.COVER? './lib-cov' : './lib');
4 changes: 4 additions & 0 deletions lib/coa.js → lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"directories": {
"lib": "./lib"
},
"main": "./lib/coa.js",
"dependencies": {
"q": "~0.8.8"
},
Expand Down
1 change: 0 additions & 1 deletion src/coa.coffee

This file was deleted.

3 changes: 3 additions & 0 deletions src/index.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exports.Cmd = require('./cmd').Cmd
exports.shell = require('./shell')
exports.require = require;
2 changes: 1 addition & 1 deletion test/shell-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var vows = require('vows'),
assert = require('assert'),
shell = require('../lib/shell');
shell = require('..').shell;

vows.describe('coa/shell').addBatch({

Expand Down

0 comments on commit d2c1b75

Please sign in to comment.