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

Vitest crashes on throwing non object data #1916

Closed
6 tasks done
Akiyamka opened this issue Aug 25, 2022 · 0 comments · Fixed by #1921
Closed
6 tasks done

Vitest crashes on throwing non object data #1916

Akiyamka opened this issue Aug 25, 2022 · 0 comments · Fixed by #1921

Comments

@Akiyamka
Copy link

Akiyamka commented Aug 25, 2022

Describe the bug

In TypeScript error always have unknown type, because it's will be valid case if code throw nothing or some primitive.
But vitest not expect that, and crashes in attempt to read error properties

Reproduction

  test.only('test', async () => {
    throw 'blablaError'
    expect(true).toBe(true);
  })

Error:

TypeError: Cannot read properties of undefined (reading 'stacks')
 ❯ parseStacktrace node_modules/vitest/dist/chunk-utils-source-map.bbf3ad19.mjs:5679:1
    5677|     return [urlLike];
    5678|   return [parts[1], parts[2] || void 0, parts[3] || void 0];
    5679| }
       | ^
    5680| function parseStacktrace(e, full = false) {
    5681|   if (e.stacks)
 ❯ printError node_modules/vitest/dist/chunk-vite-node-externalize.c843f497.mjs:9214:18
 ❯ Logger.printError node_modules/vitest/dist/chunk-vite-node-externalize.c843f497.mjs:9406:12
 ❯ DefaultReporter.printTaskErrors node_modules/vitest/dist/chunk-vite-node-externalize.c843f497.mjs:7542:29
 ❯ DefaultReporter.reportSummary node_modules/vitest/dist/chunk-vite-node-externalize.c843f497.mjs:7488:18
 ❯ process.processTicksAndRejections node:internal/process/task_queues:95:5
 ❯ DefaultReporter.onFinished node_modules/vitest/dist/chunk-vite-node-externalize.c843f497.mjs:7340:5
 ❯ DefaultReporter.onFinished node_modules/vitest/dist/chunk-vite-node-externalize.c843f497.mjs:7681:5
 ❯ Vitest.report node_modules/vitest/dist/chunk-vite-node-externalize.c843f497.mjs:9801:5

System Info

System:
    OS: Linux 5.18 Fedora Linux 36 (Workstation Edition)
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 4.81 GB / 13.50 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 18.7.0 - ~/n/bin/node
    Yarn: 1.22.19 - ~/n/bin/yarn
    npm: 8.15.0 - ~/n/bin/npm
  Browsers:
    Firefox: 103.0.1

Used Package Manager

npm

Validations

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants