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

Fix onDownloadProgress test commented out in test/browser.ts #591

Merged
merged 1 commit into from
Jun 2, 2024

Conversation

komura-c
Copy link
Contributor

@komura-c komura-c commented Jun 2, 2024

Hello, I noticed a test that was commented out in browser.ts and fixed it.
When I uncommented it, I got a ReferenceError: __name is not undefined on playweight at the following location

const decodeUtf8 = (array: Uint8Array) => String.fromCodePoint(...array);

On playweight, it is executed as follows

const decodeUtf8 = __name((array) => String.fromCodePoint(...array), "decodeUtf8")

I found out that this was due to an optimization option keepNames in vite.
refs: vite/pull/2376#issuecomment-805285480, esbuild/issues/2605#issue-1404600925

In this repository, it seems to be happening only within playweight. I don't think there is any need to make it a function except for readability, so I fixed it so that it doesn't create a function.
Just to be sure, I tried it onDownloadProgress in a vite+react environment and the same thing did not happen, so it seems to be a good fix for testing only.

@sindresorhus sindresorhus merged commit 585ebcb into sindresorhus:main Jun 2, 2024
1 check passed
@sindresorhus
Copy link
Owner

Thanks :)

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

Successfully merging this pull request may close these issues.

2 participants