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

[BUG] Regression in browser support of @tsed/core #2480

Closed
jojoxd opened this issue Oct 20, 2023 · 5 comments · Fixed by #2486
Closed

[BUG] Regression in browser support of @tsed/core #2480

jojoxd opened this issue Oct 20, 2023 · 5 comments · Fixed by #2486
Assignees

Comments

@jojoxd
Copy link
Contributor

jojoxd commented Oct 20, 2023

Describe the bug

Hi Romain,

It seems browser-support of @tsed/core is broken again.

isBuffer.ts:7 Uncaught ReferenceError: Buffer is not defined
    at x (isBuffer.ts:7:37)
    at $t (isClass.ts:22:9)
    at _A.type (JsonSchema.ts:643:21)
    at _A.set (JsonSchema.ts:750:43)
    at JsonSchema.ts:725:18
    at Array.forEach (<anonymous>)
    at _A.assign (JsonSchema.ts:724:17)
    at new _A (JsonSchema.ts:62:18)
    at _A.from (JsonSchema.ts:128:16)
    at v.build (JsonClassStore.ts:22:35)

It seems to be broken by this change; edb7624d6 isBuffer

To Reproduce

  1. Setup a project to run in the browser, doesn't matter what framework
  2. Install @tsed/schema and @tsed/core.
  3. Create a model using @tsed/schema
  4. run a getJsonSchema() on that model.
  5. Open in browser, check the logs 😄

Expected behavior

There should be no error, and I should get my json schema.

Code snippets

No response

Repository URL example

No response

OS

Fedora Core 38 (KDE Spin)

Node version

V8

Library version

v7.39.0

Additional context

Potential fix:

The change in edb7624d6 should be reverted.

@Romakita
Copy link
Collaborator

Arf…. It’s a problem, I haven’t a way to prevent this regression and clearly I need to shareable utils on core level. :(

is it possible to have something that broke the CI if the code isn’t browser compliante? @jojoxd

@jojoxd
Copy link
Contributor Author

jojoxd commented Oct 20, 2023

You could maybe run a test suite using cypress or playwright against a real browser.

Playwright supports jest (jest-playwright), which might play nice with the current test setup.

@Romakita
Copy link
Collaborator

Romakita commented Oct 24, 2023

Got a solution to for isBuffer:
https://github.com/feross/is-buffer/blob/master/index.js
it seems to be compliant with browser env.

revert code isn’t possible, and my prioritary point is nodejs env. browser env support is a plus. But to avoid future regression, adding integration test using jest-playwright is mandatory.

see you

Romakita added a commit that referenced this issue Oct 25, 2023
@Romakita Romakita linked a pull request Oct 25, 2023 that will close this issue
Romakita added a commit that referenced this issue Oct 25, 2023
Romakita added a commit that referenced this issue Oct 25, 2023
Romakita added a commit that referenced this issue Oct 26, 2023
Romakita added a commit that referenced this issue Oct 26, 2023
Romakita added a commit that referenced this issue Oct 26, 2023
Romakita added a commit that referenced this issue Oct 26, 2023
Romakita added a commit that referenced this issue Oct 26, 2023
Romakita added a commit that referenced this issue Oct 26, 2023
@github-actions
Copy link

🎉 Are you happy?

If you appreciated the support, know that it is free and is carried out on personal time ;)

A support, even a little bit makes a difference for me and continues to bring you answers!

github opencollective

@Romakita
Copy link
Collaborator

🎉 This issue has been resolved in version 7.41.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants