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

Cannot create property 'stacks' when throwing literal value #3070

Closed
6 tasks done
JoshuaKGoldberg opened this issue Mar 23, 2023 · 0 comments · Fixed by #3074
Closed
6 tasks done

Cannot create property 'stacks' when throwing literal value #3070

JoshuaKGoldberg opened this issue Mar 23, 2023 · 0 comments · Fixed by #3074

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Mar 23, 2023

Describe the bug

Throwing a literal value such as a number or string causes an error inside Vitest:

test('throwing', () => {
  throw 1337;
});
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: Cannot create property 'stacks' on number '1337'
 ❯ Module.parseErrorStacktrace file:/home/projects/vitest-dev-vitest-araj6a/node_modules/vitest/dist/chunk-utils-tasks.b41c8284.js:98:12
 ❯ eval file:/home/projects/vitest-dev-vitest-araj6a/node_modules/vitest/dist/chunk-api-setup.ac7748ac.js:4616:62
 ❯ WebSocketReporter.onTaskUpdate file:/home/projects/vitest-dev-vitest-araj6a/node_modules/vitest/dist/chunk-api-setup.ac7748ac.js:4613:11
 ❯ eval file:/home/projects/vitest-dev-vitest-araj6a/node_modules/vitest/dist/chunk-node-pkg.f9696901.js:15594:51
 ❯ Vitest.report file:/home/projects/vitest-dev-vitest-araj6a/node_modules/vitest/dist/chunk-node-pkg.f9696901.js:15592:38
 ❯ Proxy.onTaskUpdate file:/home/projects/vitest-dev-vitest-araj6a/node_modules/vitest/dist/chunk-node-pkg.f9696901.js:10394:11
 ❯ _0x238689.eval file:/home/projects/vitest-dev-vitest-araj6a/node_modules/vitest/dist/vendor-index.783e7f3e.js:57:42
 ❯ [nodejs.internal.kHybridDispatch] https:/vitestdevvitestaraj6a-urad.w-credentialless.staticblitz.com/blitz.88d3a49b591611919d7d64c44b90ff5f8e939906.js:6:413600

Seems like a regression of #1916, which was resolved by #1921.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-araj6a?file=test/basic.test.ts

System Info

See Stackblitz.

Used Package Manager

npm

Validations

@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2023
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