Skip to content

Commit

Permalink
Fix for #14. Use prepublish script to build 'lib'. Add some unit test…
Browse files Browse the repository at this point in the history
… infrastructure.
  • Loading branch information
Jason Walton committed Jan 20, 2014
1 parent eac2204 commit 93acad8
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 724 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/testdir
/node_modules
/lib
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# coffee-coverage Changelog

### v0.4.2

- Fix exclude bug when dynamically instrumenting files.

### v0.4.1

- Fix async bug when creating new directories (thanks [can3p](https://github.com/can3p)).

### v0.4.0

- Add support for literate CoffeeScript (thanks [frozenice-](https://github.com/frozenice-)).
Expand Down
50 changes: 44 additions & 6 deletions Cakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,45 @@
{exec} = require 'child_process'
{spawn, exec} = require 'child_process'

task 'build', "Build project from src/*.coffee to lib/*.js", ->
exec 'coffee --compile --output lib/ src/', (err, stdout, stderr) ->
throw err if err
process.stdout.write stdout
process.stderr.write stderr
launch = (cmd, options=[], done=null) ->
app = spawn cmd, options
app.stdout.pipe(process.stdout)
app.stderr.pipe(process.stderr)
app.on 'exit', (status) ->
err = if status isnt 0 then new Error("Error running #{cmd}") else null
done? err

build = (done) ->
console.log "Building"
exec './node_modules/.bin/coffee --compile --output lib/ src/', (err, stdout, stderr) ->
process.stderr.write stderr
return done err if err

process.stderr.write stderr
done?()

mocha = (done) ->
console.log "Testing"

options = []
options.push '--compilers'
options.push 'coffee:coffee-script'

# Colors!
options.push '-c'

# Run everything in the `test` folder.
options.push '--recursive'
options.push 'test'

options.push '--reporter'
options.push 'spec'

launch './node_modules/.bin/mocha', options, done

run = (fn) ->
->
fn (err) ->
console.log err.stack if err

task 'build', "Build project from src/*.coffee to lib/*.js", run build
task 'test', "Run mocha tests", run -> build mocha
Loading

0 comments on commit 93acad8

Please sign in to comment.