Permalink
Browse files

Fixed PROOF_NO_CLEANUP environment variable.

`PROOF_NO_CLEANUP` wasn't working.  The Proof library will skip cleanup
functions if the environment variable `PROOF_NO_CLEANUP` is set, regardless of
the value set. I'd not tested the implementation. It skipped cleanup, but in
doing so, it also skipped the test's call to `process.exit`. Now setting
`PROOF_NO_CLEANUP` will cause the tidy logic to loop through an empty list of
cleanup functions, which causes it to exit immediately.

Closes #12.
  • Loading branch information...
1 parent 05e5ada commit 7f808a0b93a2c410d2fcfe0e658409ee7d4895fc @bigeasy committed Mar 25, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/lib/proof.coffee
View
16 src/lib/proof.coffee
@@ -165,14 +165,14 @@ class Test
# the housekeepers property and empty it so we don't run more housekeepers
# from a bailout we invoke.
_tidy: (code) ->
- housekeepers = @_housekeepers.splice(0)
- if not process.env.PROOF_NO_CLEANUP
- tidy = =>
- if housekeeper = housekeepers.shift()
- housekeeper (error) => if error then @bailout error else tidy()
- else
- process.exit code
- tidy()
+ housekeepers = []
+ housekeepers = @_housekeepers.splice(0) unless process.env.PROOF_NO_CLEANUP
+ tidy = =>
+ if housekeeper = housekeepers.shift()
+ housekeeper (error) => if error then @bailout error else tidy()
+ else
+ process.exit code
+ tidy()
# A healthy end to our test program. Call any teardown hooks set by the test
# harness and then exit reflecting the pass/fail state of the program.

0 comments on commit 7f808a0

Please sign in to comment.