UNPKG

833 Btext/coffeescriptView Raw
1child_process = require 'child_process'
2
3suite 'Command line execution', ->
4 test "--eval -i", (done) ->
5 child_process.exec 'bin/coffee --eval -i test/cli-eval-errors-files/1.coffee', (error, stdout, stderr) ->
6 # Executed module is require.main
7 # Module path is relative to the file
8 # Can include another CS module
9 # Other module is not requires.main
10 eq stdout, "1 is main true\n0 is main false\n"
11
12 ok stderr.indexOf("cli-eval-errors-files/0.coffee:4:10, <js>:4:9)") > 0
13 ok stderr.indexOf("cli-eval-errors-files/1.coffee:4:6, <js>:6:9)") > 0
14
15 done()
16
17 test "--eval --cli", (done) ->
18 child_process.exec 'bin/coffee --eval --cli "require \'./test/cli-eval-errors-files/1.coffee\'"', (error, stdout, stderr) ->
19 eq stdout, "1 is main false\n0 is main false\n"
20 done()