Skip to content
This repository
Browse code

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...
commit 7f808a0b93a2c410d2fcfe0e658409ee7d4895fc 1 parent 05e5ada
Alan Gutierrez authored

Showing 1 changed file with 8 additions and 8 deletions. Show diff stats Hide diff stats

  1. +8 8 src/lib/proof.coffee
16 src/lib/proof.coffee
@@ -165,14 +165,14 @@ class Test
165 165 # the housekeepers property and empty it so we don't run more housekeepers
166 166 # from a bailout we invoke.
167 167 _tidy: (code) ->
168   - housekeepers = @_housekeepers.splice(0)
169   - if not process.env.PROOF_NO_CLEANUP
170   - tidy = =>
171   - if housekeeper = housekeepers.shift()
172   - housekeeper (error) => if error then @bailout error else tidy()
173   - else
174   - process.exit code
175   - tidy()
  168 + housekeepers = []
  169 + housekeepers = @_housekeepers.splice(0) unless process.env.PROOF_NO_CLEANUP
  170 + tidy = =>
  171 + if housekeeper = housekeepers.shift()
  172 + housekeeper (error) => if error then @bailout error else tidy()
  173 + else
  174 + process.exit code
  175 + tidy()
176 176
177 177 # A healthy end to our test program. Call any teardown hooks set by the test
178 178 # harness and then exit reflecting the pass/fail state of the program.

0 comments on commit 7f808a0

Please sign in to comment.
Something went wrong with that request. Please try again.