Skip to content

Take last matchΒ #94

@hannojg

Description

@hannojg

Sorry, if this is not the right place to ask questions about how the formatting should be done in general πŸ™‡β€β™‚οΈ

I am trying to setup reviewdog for jest (in github actions). I want reviewdog to tell me about failed tests.
This is e.g. a output when a test has failed:

 PASS  src/store/media/api/__tests__/api.test.ts
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks.

Summary of all failing tests
 FAIL  src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts
  ● Test suite failed to run

    Cannot find module '../../../../../jobs/memory/upload/job' from 'src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts'

      41 | // Mocking our components that depend on reduxStore and are causing issues.
      42 | jest.mock("src/__dev__/AccountSetup", () => ({}));
    > 43 | jest.mock("src/jobs/memory/upload/job", () => ({}));
         |      ^
      44 | jest.mock("src/store/reduxStore", () => ({}));
      45 |
      46 | it("should remove pending creation when room gets updated with last message", () => {

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
      at Object.<anonymous> (src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts:43:6)


Test Suites: 1 failed, 5 skipped, 144 passed, 145 of 150 total
Tests:       9 skipped, 302 passed, 311 total
Snapshots:   138 passed, 138 total
Time:        56.5 s
Ran all test suites.

This is the efm pattern I got, which works nicely:

%-G%[%^ ]%.%#
%E%.%#● %m
%Z%.%#at %.%# (%f:%l:%c)
%C%.%#
%-G%.%#

However, for the failed test above it reports as file:
node_modules/jest-resolve/build/index.js:306:11

This is not correct, the error originates from:
src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts:43:6

There are two at lines at the end:

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
      at Object.<anonymous> (src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts:43:6)

How can I tell the errorformat to take the last at match?

Thanks in advance!

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