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

Jest output is too verbose #836

Closed
kasperpeulen opened this issue Oct 3, 2016 · 1 comment
Closed

Jest output is too verbose #836

kasperpeulen opened this issue Oct 3, 2016 · 1 comment

Comments

@kasperpeulen
Copy link
Contributor

kasperpeulen commented Oct 3, 2016

I would like to be able to make the Jest output less verbose. For example, I have only 4 failing tests, and I run it with o to only run new tests after commit, however, it still prints multiple screen sizes of info. This is all I can see on my 15 inch macbook:

screen shot 2016-10-03 at 21 06 45

The total log is:

 FAIL  src/maxima/maxima3.test.js
  maxima
    ✕ a: 1; b: 2; c: 3 becomes {"a":"1","b":"2","c":"3"} (1ms)
    ✕ a: 1; b: 2$ c: 3 becomes {"a":"1","c":"3"} (1ms)
    ✕ a: 1; b: 2$ c: 1/0; d: diff(x^2,x) becomes {"a":"1","c":"<error>\nexpt: undefined: 0 to a negative exponent.\n</error>","d":"2*x"} (1ms)
    ✕ a: 1; c: 3x; d: diff(x^2,x) becomes {"a":"1","c":"<error>\nincorrect syntax: x is not an infix operator\n c: 3x;\n     ^\n</error>"} (1ms)

  ● maxima › a: 1; b: 2; c: 3 becomes {"a":"1","b":"2","c":"3"}

    expect(received).toEqual(expected)

    Expected value to equal:
      {"a":"1","b":"2","c":"3"}
    Received:
      "undefined"

    Difference:

    Comparing two different types of values:
      Expected: object
      Received: undefined

      at Object._callee$ (src/maxima/maxima3.test.js:41:30)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:62:40)
      at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:336:22)
      at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:95:21)
      at step (src/maxima/maxima3.test.js:1:1299)
      at src/maxima/maxima3.test.js:1:1459
      at process._tickCallback (internal/process/next_tick.js:103:7)

  ● maxima › a: 1; b: 2$ c: 3 becomes {"a":"1","c":"3"}

    expect(received).toEqual(expected)

    Expected value to equal:
      {"a":"1","c":"3"}
    Received:
      "undefined"

    Difference:

    Comparing two different types of values:
      Expected: object
      Received: undefined

      at Object._callee$ (src/maxima/maxima3.test.js:41:30)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:62:40)
      at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:336:22)
      at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:95:21)
      at step (src/maxima/maxima3.test.js:1:1299)
      at src/maxima/maxima3.test.js:1:1459
      at process._tickCallback (internal/process/next_tick.js:103:7)

  ● maxima › a: 1; b: 2$ c: 1/0; d: diff(x^2,x) becomes {"a":"1","c":"<error>\nexpt: undefined: 0 to a negative exponent.\n</error>","d":"2*x"}

    expect(received).toEqual(expected)

    Expected value to equal:
      {"a":"1","c":"<error>\nexpt: undefined: 0 to a negative exponent.\n</error>","d":"2*x"}
    Received:
      "undefined"

    Difference:

    Comparing two different types of values:
      Expected: object
      Received: undefined

      at Object._callee$ (src/maxima/maxima3.test.js:41:30)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:62:40)
      at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:336:22)
      at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:95:21)
      at step (src/maxima/maxima3.test.js:1:1299)
      at src/maxima/maxima3.test.js:1:1459
      at process._tickCallback (internal/process/next_tick.js:103:7)

  ● maxima › a: 1; c: 3x; d: diff(x^2,x) becomes {"a":"1","c":"<error>\nincorrect syntax: x is not an infix operator\n c: 3x;\n     ^\n</error>"}

    expect(received).toEqual(expected)

    Expected value to equal:
      {"a":"1","c":"<error>\nincorrect syntax: x is not an infix operator\n c: 3x;\n     ^\n</error>","d":"undefined"}
    Received:
      "undefined"

    Difference:

    Comparing two different types of values:
      Expected: object
      Received: undefined

      at Object._callee$ (src/maxima/maxima3.test.js:41:30)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:62:40)
      at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:336:22)
      at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:95:21)
      at step (src/maxima/maxima3.test.js:1:1299)
      at src/maxima/maxima3.test.js:1:1459
      at process._tickCallback (internal/process/next_tick.js:103:7)

Test Summary
 › Ran all tests related to changed files.
 › 4 tests failed, 0 tests passed (4 total in 1 test suite, run time 0.065s)

Watch Usage
 › Press a to run all tests.
 › Press p to filter by a filename regex pattern.
 › Press q to quit watch mode.
 › Press Enter to trigger a test run.

I don't want to see all the stacktraces, they rarely show me anything I want to see. For example, you could shrink it like this:

 FAIL  src/maxima/maxima3.test.js
  maxima
    ✕ a: 1; b: 2; c: 3 becomes {"a":"1","b":"2","c":"3"} (1ms)
    ✕ a: 1; b: 2$ c: 3 becomes {"a":"1","c":"3"} (1ms)
    ✕ a: 1; b: 2$ c: 1/0; d: diff(x^2,x) becomes {"a":"1","c":"<error>\nexpt: undefined: 0 to a negative exponent.\n</error>","d":"2*x"} (1ms)
    ✕ a: 1; c: 3x; d: diff(x^2,x) becomes {"a":"1","c":"<error>\nincorrect syntax: x is not an infix operator\n c: 3x;\n     ^\n</error>"} (1ms)

  ● maxima › a: 1; b: 2; c: 3 becomes {"a":"1","b":"2","c":"3"}

    expect(received).toEqual(expected)

    Expected value to equal:
      {"a":"1","b":"2","c":"3"}
    Received:
      "undefined"

    Difference:

    Comparing two different types of values:
      Expected: object
      Received: undefined

  ● maxima › a: 1; b: 2$ c: 3 becomes {"a":"1","c":"3"}

    expect(received).toEqual(expected)

    Expected value to equal:
      {"a":"1","c":"3"}
    Received:
      "undefined"

    Difference:

    Comparing two different types of values:
      Expected: object
      Received: undefined

  ● maxima › a: 1; b: 2$ c: 1/0; d: diff(x^2,x) becomes {"a":"1","c":"<error>\nexpt: undefined: 0 to a negative exponent.\n</error>","d":"2*x"}

    expect(received).toEqual(expected)

    Expected value to equal:
      {"a":"1","c":"<error>\nexpt: undefined: 0 to a negative exponent.\n</error>","d":"2*x"}
    Received:
      "undefined"

    Difference:

    Comparing two different types of values:
      Expected: object
      Received: undefined

  ● maxima › a: 1; c: 3x; d: diff(x^2,x) becomes {"a":"1","c":"<error>\nincorrect syntax: x is not an infix operator\n c: 3x;\n     ^\n</error>"}

    expect(received).toEqual(expected)

    Expected value to equal:
      {"a":"1","c":"<error>\nincorrect syntax: x is not an infix operator\n c: 3x;\n     ^\n</error>","d":"undefined"}
    Received:
      "undefined"

    Difference:

    Comparing two different types of values:
      Expected: object
      Received: undefined

Test Summary
 › Ran all tests related to changed files.
 › 4 tests failed, 0 tests passed (4 total in 1 test suite, run time 0.065s)

Watch Usage
 › Press a to run all tests.
 › Press p to filter by a filename regex pattern.
 › Press q to quit watch mode.
 › Press Enter to trigger a test run.

I think there could be done more to save more space, and see more relevant info in a blink of an eye, but this would help a lot.

@gaearon
Copy link
Contributor

gaearon commented Nov 20, 2016

Thanks for feedback!
Could you file this with Jest please?
Stacktraces are often essential so this feature is hard to get right, and it would be best to discuss various UX options with Jest maintainers.

@gaearon gaearon closed this as completed Nov 20, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants