Skip to content

Jest output is too verbose  #836

Closed
Closed
@kasperpeulen

Description

@kasperpeulen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions