1 | assert = require 'assert'
|
2 | fs = require 'fs'
|
3 | execSync = require 'execSync'
|
4 |
|
5 | suite 'Cmd output', ->
|
6 | setup ->
|
7 | process.chdir __dirname
|
8 | @cmd = '../bin/coffee-inline-map'
|
9 |
|
10 | test 'empty stdin', ->
|
11 | r = execSync.exec "echo '' | #{@cmd}"
|
12 | assert.equal '', r.stdout
|
13 |
|
14 | test 'js with source map from usual coffee from stdin', ->
|
15 | r = execSync.exec "#{@cmd} < data/src/a.coffee"
|
16 | assert.equal (fs.readFileSync 'data/src/a.js.stdin.should').toString(), r.stdout
|
17 |
|
18 | test 'js with source map from usual coffee', ->
|
19 | r = execSync.exec "#{@cmd} data/src/a.coffee"
|
20 | assert.equal (fs.readFileSync 'data/src/a.js.should').toString(), r.stdout
|
21 |
|
22 | test 'js without source map from usual coffee', ->
|
23 | r = execSync.exec "#{@cmd} --no-map data/src/a.coffee"
|
24 | assert.equal (fs.readFileSync 'data/src/a.js.mapless.should').toString(), r.stdout
|
25 |
|
26 | test 'js with source map from litcoffee', ->
|
27 | r = execSync.exec "#{@cmd} data/src/b.litcoffee"
|
28 | assert.equal (fs.readFileSync 'data/src/b.js.should').toString(), r.stdout
|
29 |
|
30 | test 'error due to not recognizing litcoffee', ->
|
31 | r = execSync.exec "#{@cmd} < data/src/b.coffee.md"
|
32 | assert.equal 1, r.code
|
33 |
|
34 | test 'js with source map from litcoffee from stdin', ->
|
35 | r = execSync.exec "#{@cmd} -l < data/src/b.coffee.md"
|
36 | assert.equal (fs.readFileSync 'data/src/b.js.stdin.should').toString(), r.stdout
|
37 |
|
38 | test 'bare js with source map usual coffee', ->
|
39 | r = execSync.exec "#{@cmd} -b data/src/a.coffee"
|
40 | assert.equal (fs.readFileSync 'data/src/a.js.bare.should').toString(), r.stdout
|