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

Show relevant parts of the object/array for t.true/t.false assertion output #1205

Closed
vadimdemedes opened this issue Jan 23, 2017 · 5 comments
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement new functionality scope:assertions

Comments

@vadimdemedes
Copy link
Contributor

vadimdemedes commented Jan 23, 2017

Issuehunt badges

Note, this issue is related only to #1154.

Given this assertion:

t.true(arr[56]);

if the size of arr is (for example) 100, AVA will output the whole array without pointing to the specific item that caused an assertion error. We should show only the relevant parts of the array/object to identify the cause of an issue quicker. Plus, we really don't want to trash user's terminal.


IssueHunt Summary

Sponsors (Total: $60.00)

Become a sponsor now!

Or submit a pull request to get the deposits!

Tips

@vadimdemedes vadimdemedes added enhancement new functionality future we'll get back to this eventually labels Jan 23, 2017
@yatharthx
Copy link
Contributor

@vadimdemedes thanks for pointing it out. I actually faced this thing last night and was thinking to open an issue.

@novemberborn
Copy link
Member

My suggestion in #1204 is to show the type of arr but nothing else.

@leandrooriente
Copy link

Guys, do you have any update regarding this request?

I'm facing the same issue.
If I use t.is(resetBehaviour.calledOnce, false); it outputs this:

51:     wrapper.unmount();
   52:     t.is(resetBehaviour.calledOnce, false);
   53: });

  Difference:

  - true
  + false

  Test.is (src/common/components/App/App.test.js:52:7)
  processEmit [as emit] (node_modules/nyc/node_modules/signal-exit/index.js:155:32)
  processEmit [as emit] (node_modules/nyc/node_modules/signal-exit/index.js:155:32)

But if i use t.false(resetBehaviour.calledOnce) it returns this huge output:

51:     wrapper.unmount();
   52:     t.false(resetBehaviour.calledOnce);
   53: });

  Value is not `false`:

  true

  resetBehaviour.calledOnce
  => true

  resetBehaviour
  => Function proxy {
    args: [
      [],
    ],
    callCount: 1,
    callIds: [
      4,
    ],
    called: true,
    calledOnce: true,
    calledThrice: false,
    calledTwice: false,
    displayName: 'spy',
    errorsWithCallStack: [
      Error {
        message: '',
      },
    ],
    exceptions: [
      undefined,
    ],
    firstCall: {
      args: [],
      callId: 4,
      callback: undefined,
      errorWithCallStack: Error {
        message: '',
      },
      exception: undefined,
      lastArg: undefined,
      proxy: [Circular],
      returnValue: undefined,
      thisValue: {
        resetBehaviour: [Circular],
      },
    },
    id: 'spy#3',
    instantiateFake: Function create {},
    isSinonProxy: true,
    lastCall: {
      args: [],
      callId: 4,
      callback: undefined,
      errorWithCallStack: Error {
        message: '',
      },
      exception: undefined,
      lastArg: undefined,
      proxy: [Circular],
      returnValue: undefined,
      thisValue: {
        resetBehaviour: [Circular],
      },
    },
    notCalled: false,
    returnValues: [
      undefined,
    ],
    secondCall: null,
    thirdCall: null,
    thisValues: [
      {
        resetBehaviour: [Circular],
      },
    ],
    toString: Function toString {},
  }

  Test.t [as fn] (src/common/components/App/App.test.js:52:5)
  processEmit [as emit] (node_modules/nyc/node_modules/signal-exit/index.js:155:32)
  processEmit [as emit] (node_modules/nyc/node_modules/signal-exit/index.js:155:32)

I'm using sinon spies and the log output is completely uselesss in this case.

@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label Jun 9, 2019
@IssueHuntBot
Copy link

@issuehunt has funded $60.00 to this issue.


@novemberborn
Copy link
Member

FWIW, AVA no longer prints output like this, though it's supported through @ava/babel. I'm going to close this issue since I don't think we'll make any progress on this one way or the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement new functionality scope:assertions
Projects
None yet
Development

No branches or pull requests

5 participants