Testy / TestyTs

✔️ Modern TypeScript testing framework.
http://testy.github.io
ISC License
123 stars 8 forks source link

Improve errors logging #82

Open Aboisier opened 3 years ago

Aboisier commented 3 years ago

Recently, the logging was improved by printing the stacktrace of failed tests.

It would be interesting to see a summary of the failed tests to prevent having to scroll to find failed tests.

Current behaviour

Root
  Expect ArraysToBeEqual Test Suite
    Arrays to be equal
      √ arrays with undefined values
      √ empty arrays

[cropped]

  Test Runner Visitor Error Messages Tests
    x Asynchronous tests failures  - Expected test to succeed.
      Error: Expected test to succeed.
          at Expect.toBeEqual (C:\testyts\TestyTs\src\lib\assertion\expect.ts:34:13)
          at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:16:12)
          at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:28:12)
          at TestRunnerVisitorTests.<anonymous> (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:44:15)
          at Generator.next (<anonymous>)
          at fulfilled (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:11:58)
    √ Tests failures

  Test Runner Visitor Tests
    x Simple test suite - Expected B to equal C.
      Error: Expected B to equal C.
          at Expect.toBeEqual (C:\testyts\TestyTs\src\lib\assertion\expect.ts:34:13)
          at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:16:12)
          at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:28:12)
          at TestRunnerVisitorTests.<anonymous> (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:44:15)
          at Generator.next (<anonymous>)
          at fulfilled (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:11:58)
    √ Test suite with failure
    √ Test suite with skipped tests
    √ Skipped and focused

  Tests Suite Testszz
    √ get tests, all normal tests

Summary: 182/183 passed, 1/183 failed, 0/183 skipped. (0.202s)

Suggested behaviour

Root
  Expect ArraysToBeEqual Test Suite
    Arrays to be equal
      √ arrays with undefined values
      √ empty arrays

[cropped]

  Test Runner Visitor Error Messages Tests
    x Asynchronous tests failures  - Expected test to succeed.
      Error: Expected test to succeed.
          at Expect.toBeEqual (C:\testyts\TestyTs\src\lib\assertion\expect.ts:34:13)
          at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:16:12)
          at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:28:12)
          at TestRunnerVisitorTests.<anonymous> (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:44:15)
          at Generator.next (<anonymous>)
          at fulfilled (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:11:58)
    √ Tests failures

  Test Runner Visitor Tests
    x Simple test suite - Expected B to equal C.
      Error: Expected B to equal C.
          at Expect.toBeEqual (C:\testyts\TestyTs\src\lib\assertion\expect.ts:34:13)
          at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:16:12)
          at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:28:12)
          at TestRunnerVisitorTests.<anonymous> (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:44:15)
          at Generator.next (<anonymous>)
          at fulfilled (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:11:58)
    √ Test suite with failure
    √ Test suite with skipped tests
    √ Skipped and focused

  Tests Suite Testszz
    √ get tests, all normal tests

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Summary: 182/183 passed, 1/183 failed, 0/183 skipped. (0.202s)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

x Asynchronous tests failures  - Expected test to succeed.
  Error: Expected test to succeed.
      at Expect.toBeEqual (C:\testyts\TestyTs\src\lib\assertion\expect.ts:34:13)
      at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:16:12)
      at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:28:12)
      at TestRunnerVisitorTests.<anonymous> (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:44:15)
      at Generator.next (<anonymous>)
      at fulfilled (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:11:58)

x Simple test suite - Expected B to equal C.
  Error: Expected B to equal C.
      at Expect.toBeEqual (C:\testyts\TestyTs\src\lib\assertion\expect.ts:34:13)
      at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:16:12)
      at Function.expectReportsToBeEqual (C:\testyts\TestyTs\src\spec\utils\testUtils.ts:28:12)
      at TestRunnerVisitorTests.<anonymous> (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:44:15)
      at Generator.next (<anonymous>)
      at fulfilled (C:\testyts\TestyTs\src\spec\tests\testRunnerVisitor.spec.ts:11:58)