Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failure doesn't produce stacks if actual value is falsy #399

Closed
nhamer opened this issue Oct 7, 2017 · 2 comments
Closed

failure doesn't produce stacks if actual value is falsy #399

nhamer opened this issue Oct 7, 2017 · 2 comments
Labels

Comments

@nhamer
Copy link
Contributor

nhamer commented Oct 7, 2017

https://github.com/substack/tape/blob/b66f8f80928bb82f0817407880a139ad118daf01/lib/results.js#L160

test('failureStacks', function(t) {
  t.equal(true, false); // returns a full stack
  t.equal(false, true); // no stack
  t.end();
});
@nhamer nhamer changed the title failure doesn't produce stacks if expected value is falsey failure doesn't produce stacks if actual value is falsey Oct 7, 2017
@ljharb ljharb changed the title failure doesn't produce stacks if actual value is falsey failure doesn't produce stacks if actual value is falsy Oct 7, 2017
@ljharb
Copy link
Collaborator

ljharb commented Oct 7, 2017

What do you mean by "stack" here? Error objects have stacks; not assertions.

@nhamer
Copy link
Contributor Author

nhamer commented Oct 8, 2017

Sorry for the imprecision - I mean the output of the above test is:

TAP version 13

failureStacks

not ok 1 should be equal

operator: equal
expected: false
actual:   true
at: Test.<anonymous> (c:\myproj\test.js:3:5)
stack: |-
  Error: should be equal
      at Test.assert [as _assert] (c:\myproj\node_modules\tape\lib\test.js:212:54)
      at Test.bound [as _assert] (c:\myproj\node_modules\tape\lib\test.js:64:32)
      at Test.equal.Test.equals.Test.isEqual.Test.is.Test.strictEqual.Test.strictEquals (c:\myproj\node_modules\tape\lib\test.js:347:10)
      at Test.bound (c:\myproj\node_modules\tape\lib\test.js:64:32)
      at Test.<anonymous> (c:\myproj\test.js:3:5)
      at Test.bound [as _cb] (c:\myproj\node_modules\tape\lib\test.js:64:32)
      at Test.run (c:\myproj\node_modules\tape\lib\test.js:83:10)
      at Test.bound [as run] (c:\myproj\node_modules\tape\lib\test.js:64:32)
      at Immediate.next (c:\myproj\node_modules\tape\lib\results.js:71:15)
      at runCallback (timers.js:672:20)

...
not ok 2 should be equal

operator: equal
expected: true
actual:   false
at: Test.<anonymous> (c:\myproj\test.js:4:5)

...

1..2

tests 2

pass 0

fail 2

nhamer added a commit to nhamer/tape that referenced this issue Oct 9, 2017
ljharb pushed a commit to nhamer/tape that referenced this issue Oct 18, 2017
@ljharb ljharb added the bug label Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants