cloudkick/whiskey — pull request #51 by sam-falvo (2013-04-20 00:57:48+00:00)
Title: Hackday whiskey new api -- DO NOT MERGE -- attempting to create proper setup/teardown functionality for Whiskey (to end all setups/teardowns)

The problem with this commit, however, is that it doesn't work. If you run the test example like so:

bin/whiskey --tests example/v0.8.0/test-success.js

you'll see an output that includes this:

Stdout:
BEFORE 0 success_suite
BEFORE 1 true_equals_true
CASE 0 0 success_suite
AFTER 0 success_suite
BEFORE 0 success_suite
BEFORE 1 true_equals_true
CASE 0 1 success_suite
AFTER 0 success_suite
BEFORE 0 success_suite
BEFORE 1 true_equals_true
CASE 1 0 true_equals_true
AFTER 0 success_suite

What it *should* be is this:

Stdout:
BEFORE 0 success_suite
CASE 0 0 success_suite
AFTER 0 success_suite
BEFORE 0 success_suite
CASE 0 1 success_suite
AFTER 0 success_suite
BEFORE 0 success_suite
BEFORE 1 true_equals_true
CASE 1 0 true_equals_true
AFTER 0 success_suite

EVEN though I'm generating all-new lists of before- and after-methods, and even though I'm generating all new function instances to embed in test functions, and even though every object appears to have its own identity (as far as I know how to tell in Javascript), it looks exactly as though success_suite's before function list is being overwritten by true_equals_true's list.

I've tried all manner of tricks to ensure uniqueness in this array:

1) new Array(...)
2) [...].slice()

but nothing helps!!

I'm at a complete loss to explain what's happening.