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

Error.cause, possible regression from vite 3.1.4 (esnext) #10292

Closed
7 tasks done
belgattitude opened this issue Sep 29, 2022 · 2 comments
Closed
7 tasks done

Error.cause, possible regression from vite 3.1.4 (esnext) #10292

belgattitude opened this issue Sep 29, 2022 · 2 comments

Comments

@belgattitude
Copy link

belgattitude commented Sep 29, 2022

Describe the bug

My tests (vitest) started to fail after update to 3.1.4. Not a big deal the workaround is simple, but I prefer to share the info.

belgattitude/http-exception#83

Seems related to the change of esbuild target in dev: refs #10215 and #10207.

It's about the Error.cause, see usage https://belgattitude.github.io/http-exception/#/?id=about-errorcause

Here's the test that fails

https://github.com/belgattitude/http-exception/blob/599fa76113c3fc53c71e935133f52cabe13423cf/packages/http-exception/src/base/__tests__/HttpException.test.ts#L36-L48

image

As a workaround I've just set explicitly the target to node14 (many targets works, just not esnext).

https://github.com/belgattitude/http-exception/pull/82/files#diff-bf307cafcebcb7d56cd0b4a3017f12f6a1ba9a768ecd1de52df5c77158cf2e78

Not knowledgeable enough to know if it's important. Just wanted to share, please feel free to close.

By the way, thanks a lot for the work you're doing 👍

Reproduction

belgattitude/http-exception#83

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    Memory: 858.00 MB / 15.29 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    Yarn: 4.0.0-rc.22 - ~/.nvm/versions/node/v16.17.0/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
  Browsers:
    Chrome: 105.0.5195.125
    Firefox: 105.0.1

Used Package Manager

yarn

Logs

No response

Validations

@sapphi-red
Copy link
Member

This is happening because useDefineForClassFields is true for Vite 3.1.4+.
If you set useDefineForClassFields: false in tsconfig.json, the test won't fail.

I'm not sure why it was false before Vite 3.1.4, but I think the current behavior is correct.

@belgattitude
Copy link
Author

Thanks make sense now.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants