Skip to content

Commit

Permalink
update tests to invoke src script instead of an installed app
Browse files Browse the repository at this point in the history
  • Loading branch information
timoxley committed Feb 3, 2012
1 parent d3f08ce commit deeb18c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/test.spec.coffee
Expand Up @@ -15,19 +15,19 @@ describe "stitchup", ->


it 'displays usage', (done) ->
require('child_process').exec 'stitchup', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee', (error, stdout, stderr) ->
assert.ok(error)
assert.ok(/Usage:/.test(stderr))
done()

it 'displays missing', (done) ->
require('child_process').exec 'stitchup', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee', (error, stdout, stderr) ->
assert.ok(error)
assert.ok(/Not enough non-option arguments: got 0, need at least 1/.test(stderr))
done()

it 'compiles commonjs coffeescript modules', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/a.js ./test/fixtures/a', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/a.js ./test/fixtures/a', (error, stdout, stderr) ->
assert.ok(!error)
assert.ok(!stderr)
bundle = require('./tmp/a.js')
Expand All @@ -37,7 +37,7 @@ describe "stitchup", ->
done()

it 'compiles with no -s', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/a.js ./test/fixtures/a', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/a.js ./test/fixtures/a', (error, stdout, stderr) ->
assert.ok(!error)
assert.ok(!stderr)
bundle = require('./tmp/a.js')
Expand All @@ -46,7 +46,7 @@ describe "stitchup", ->
assert.equal(bundle.require('a'), 'whoo')
done()
it 'compiles multiple sources with no -s', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/ab.js ./test/fixtures/a ./test/fixtures/b', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/ab.js ./test/fixtures/a ./test/fixtures/b', (error, stdout, stderr) ->
assert.ok(!error)
assert.ok(!stderr)

Expand All @@ -57,7 +57,7 @@ describe "stitchup", ->
assert.ok(bundle.require('b'), 'whaarr')
done()
it 'compresses output', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/a.1.js ./test/fixtures/a', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/a.1.js ./test/fixtures/a', (error, stdout, stderr) ->
assert.ok(!error)
assert.ok(!stderr)

Expand All @@ -66,7 +66,7 @@ describe "stitchup", ->
done()

it 'doesn\'t compress output in development mode', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/a.2.js -m DEVELOPMENT ./test/fixtures/a', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/a.2.js -m DEVELOPMENT ./test/fixtures/a', (error, stdout, stderr) ->
assert.ok(!error)
assert.ok(!stderr)

Expand All @@ -75,7 +75,7 @@ describe "stitchup", ->
assert.ok(!(/0 \.\/test\/tmp\/a\.2\.js/.test(stdout)))
done()
it 'compiles nested coffeescript commonjs modules', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/b.js ./test/fixtures/b', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/b.js ./test/fixtures/b', (error, stdout, stderr) ->
assert.ok(!error)
assert.ok(!stderr)

Expand All @@ -90,7 +90,7 @@ describe "stitchup", ->
assert.equal(bundle.require('nesting/nesting'), 'whooo')
done()
it 'compiles commonjs javascript modules', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/c.js ./test/fixtures/c', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/c.js ./test/fixtures/c', (error, stdout, stderr) ->
assert.ok(!error)
assert.ok(!stderr)

Expand All @@ -101,7 +101,7 @@ describe "stitchup", ->
done()

it 'doesn\'t expose anything from libs with no exports', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/d.js ./test/fixtures/d', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/d.js ./test/fixtures/d', (error, stdout, stderr) ->
assert.ok(!error)
assert.ok(!stderr)

Expand All @@ -111,7 +111,7 @@ describe "stitchup", ->
done()

it 'displays an error if you try to compile an non-existant invalid file', (done) ->
require('child_process').exec 'stitchup -o ./test/tmp/d.js ./test/fixtures/invalid', (error, stdout, stderr) ->
require('child_process').exec 'coffee ./src/stitchup.coffee -o ./test/tmp/d.js ./test/fixtures/invalid', (error, stdout, stderr) ->
assert.ok(error)
assert.ok(/AssertionError: Invalid source file given\./.test(stderr))
done()

0 comments on commit deeb18c

Please sign in to comment.