question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

broken stacktraces + reproduce repo

See original GitHub issue

Describe the bug

There are alot of wrong stack traces in my tests. In this reporduction, I see 2 stacktraces for an error: invalid + valid one.

In my real repo, I only see one invalid stacktrace.


Reproduction information:

Broken stacktraces:

image

Wrong stacktraces: (the upper stacktrces are wrong, the lower are correct) image

Here is a huge hint:

When replacing the order of these two lines, the stacktraces are correct:

image

image

vitest:

/// <reference types="vitest" />

import { defineConfig } from 'vitest/config'
import tsconfigPaths from 'vite-tsconfig-paths'
import path from 'path'

// @ts-ignore
export default defineConfig({
  // @ts-ignore
  plugins: [tsconfigPaths({ root: __dirname })],
  test: {
    environment: 'node',
    watch: false,
    testTimeout: 60_000,
    env: {
      IS_TEST_MODE: 'true',
    },
    allowOnly: true,
    setupFiles: [path.join(__dirname, 'vitest.before-all.ts')],
  },
})

Reproduction

Here is a minimal repo (as far as I could. any additional change can/will possibily make different results):

https://github.com/stavalfi/vitest-wrong-stacktraces-reproduce

run: yarn test

test is located at: packages/il-backend/__tests__/sanity.spec.ts

System Info

System:
    OS: macOS 12.2.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 7.89 GB / 32.00 GB
    Shell: 3.3.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 16.13.2 - /var/folders/sn/b0rx6xbx6snfcp1r0grqp6km0000gn/T/fnm_multishells/11306_1652852702882/bin/node
    Yarn: 1.18.0 - /var/folders/sn/b0rx6xbx6snfcp1r0grqp6km0000gn/T/fnm_multishells/11306_1652852702882/bin/yarn
    npm: 8.1.2 - /var/folders/sn/b0rx6xbx6snfcp1r0grqp6km0000gn/T/fnm_multishells/11306_1652852702882/bin/npm
  Browsers:
    Chrome: 101.0.4951.64
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-react-refresh: ^1.3.1 => 1.3.6
    vite: ^2.9.5 => 2.9.5
    vitest: ^0.12.6 => 0.12.6


### Used Package Manager

yarn

### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitest-dev/vitest/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitest.dev/guide/).
- [X] Check that there isn't [already an issue](https://github.com/vitest-dev/vitest/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions) or join our [Discord Chat Server](https://chat.vitest.dev).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sheremet-vacommented, Jun 15, 2022

Single wrong stacktrace is printed by you console.logging.

Th reproduction is too verbose. All I can see is if it fails before the event loop finishes, then Vitest shows our error. If not, then Vitest can’t catch error. The issue is with your setup.

0reactions
stavalficommented, Jun 14, 2022

@sheremet-va Thanks.

This is a bug because in other tests which it’s harder to reproduce, vitest prints a single wrong stacktraces without a correct stcktraces.

I worked really hard to give you this reproduction and this is a huge clue for the more critical bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stack trace when doing `git clone` (#810) · Issues - GitLab
This happened when attemping to clone a repo on a remote machine, strack trace was visible on remote machine. Attempt at reproducing failed, ......
Read more >
REP_12400: Repository Error - Informatica Network
This issue occurs because of a crash in the Oracle client. The stack trace from the domain logs shows the following trace and...
Read more >
How to diagnose a broken git repository - Stack Overflow
I suspect the same thing that you do: that Git-LFS is involved. When using Git-LFS, many operations within a repository, including adding ...
Read more >
Unable to list contents of virtual repo when there is a broken ...
txt attachment for the stack trace. This bug was isolated on helm virtual repos, I did not see this issue on a virtual...
Read more >
NET nanoFramework extension broken on 17.3
End of stack trace from previous location where exception was thrown — ... in our GitHub repo at https://github.com/dotnet/project-system/issues/8518.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found