@@ -51,6 +51,17 @@ build = (cb) ->
5151 buildParser ()
5252 buildExceptParser cb
5353
54+ testBuiltCode = (watch = no ) ->
55+ csPath = ' ./lib/coffee-script'
56+ csDir = path .dirname require .resolve csPath
57+
58+ for mod of require .cache when csDir is mod[0 ... csDir .length ]
59+ delete require .cache [mod]
60+
61+ testResults = runTests require csPath
62+ unless watch
63+ process .exit 1 unless testResults
64+
5465
5566# Run a CoffeeScript through our node/coffee interpreter.
5667run = (args , cb ) ->
@@ -74,15 +85,7 @@ task 'build:except-parser', 'build the CoffeeScript compiler, except for the Jis
7485
7586task ' build:full' , ' build the CoffeeScript compiler from source twice, and run the tests' , ->
7687 build ->
77- build ->
78- csPath = ' ./lib/coffee-script'
79- csDir = path .dirname require .resolve csPath
80-
81- for mod of require .cache when csDir is mod[0 ... csDir .length ]
82- delete require .cache [mod]
83-
84- unless runTests require csPath
85- process .exit 1
88+ build testBuiltCode
8689
8790task ' build:browser' , ' build the merged script for inclusion in the browser' , ->
8891 code = """
@@ -202,7 +205,7 @@ buildDocs = (watch = no) ->
202205 if watch
203206 for target in [indexFile, versionedSourceFolder, examplesSourceFolder, sectionsSourceFolder]
204207 fs .watch target, interval : 200 , renderIndex
205- log ' watching...' , green
208+ log ' watching...' , green
206209
207210task ' doc:site' , ' build the documentation for the website' , ->
208211 buildDocs ()
@@ -252,7 +255,7 @@ buildDocTests = (watch = no) ->
252255 if watch
253256 for target in [testFile, testsSourceFolder]
254257 fs .watch target, interval : 200 , renderTest
255- log ' watching...' , green
258+ log ' watching...' , green
256259
257260task ' doc:test' , ' build the browser-based tests' , ->
258261 buildDocTests ()
@@ -268,7 +271,7 @@ buildAnnotatedSource = (watch = no) ->
268271
269272 if watch
270273 fs .watch ' src/' , interval : 200 , generateAnnotatedSource
271- log ' watching...' , green
274+ log ' watching...' , green
272275
273276task ' doc:source' , ' build the annotated source documentation' , ->
274277 buildAnnotatedSource ()
0 commit comments