isaacs/tap-producer — pull request #1 by jeffbski (2011-11-07 22:20:34+00:00)
Title: move stack to end of encodeResult object so valuable debug values are not truncated by yamlish

move stack to end of encodeResult object so valuable debug values are not truncated.

Previously yamlish.encode of the encodeResult debug object truncates important debug fields like

- found
- wanted
- diff

because the stack field occurs before the other fields when it serializes the output.

Example before this modification:

tap ./test not ok arguments-test.js ............ 5/6
Command: "node" "arguments-test.js"
ok 1 should be empty array
ok 2 should be empty array
ok 3 should be empty array
ok 4 type is Array
ok 5 should be similar
not ok 6 should be equal
---
file: /Users/barczewskij/projects/ensure-array/test/arguments-test.js
line: 33
column: 5
stack:
- getCaller (/Users/barczewskij/projects/ensure-array/node_modules/tap/node_modules/tap-assert/assert.js:369:17)
- assert (/Users/barczewskij/projects/ensure-array/node_modules/tap/node_modules/tap-assert/assert.js:17:16)
- Function.equal (/Users/barczewskij/projects/ensure-array/node_modules/tap/node_modules/tap-assert/assert.js:158:10)
- Test._testAssert (/Users/barczewskij/projects/ensure-array/node_modules/tap/node_modules/tap-test/test.js:86:16)
- Test. (/Users/barczewskij/projects/ensure-array/test/arguments-test.js:33:5)
- Test. (native)
- Test. (events.js:61:17)

-------

Example after this modification:

tap ./test
not ok arguments-test.js ............ 5/6
Command: "node" "arguments-test.js"
ok 1 should be empty array
ok 2 should be empty array
ok 3 should be empty array
ok 4 type is Array
ok 5 should be similar
not ok 6 should be equal
---
file: /Users/barczewskij/projects/ensure-array/test/arguments-test.js
line: 33
column: 5
found: foo
wanted: bar
diff: |
FOUND: foo
WANTED: bar
^ (at position = 0)
unique: 5
stack:
- getCaller (/Users/barczewskij/projects/ensure-array/node_modules/tap/node_modules/tap-assert/assert.js:369:17)
- assert (/Users/barczewskij/projects/ensure-array/node_modules/tap/node_modules/tap-assert/assert.js:17:16)
- Function.equal (/Users/barczewskij/projects/ensure-array/node_modules/tap/node_modules/tap-assert/assert.js:158:10)
- Test._testAssert (/Users/barczewskij/projects/ensure-array/node_modules/tap/node_modules/tap-test/test.js:86:16)