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

Add additional testing with bundle sizes for TypeScript #1444

Merged
merged 8 commits into from
Mar 13, 2024

Conversation

smaye81
Copy link
Member

@smaye81 smaye81 commented Mar 12, 2024

This expands the bundle-size directory to include testing and size calculations for both JavaScript and TypeScript. Currently, the code only calculates bundle size for JavaScript and generated JS files from Protobuf-ES and it does not verify that the code generated by the bundlers actually runs.

Now, each subdirectory for the bundlers has been expanded to generate JS files as well as TS+DTS files. The bundlers bundle each as separate entry points and then calculate the bundle size for TypeScript as well as JavaScript. In addition, it runs the code generated by the bundlers for both TS and JS and verifies that imports are correct and the code runs.

This is helpful to test code that returns type information at runtime. For example, it allows us to now verify that adding PURE annotations to generated TypeScript for enums will throw errors at runtime.

@smaye81
Copy link
Member Author

smaye81 commented Mar 12, 2024

@timostamm Verified that the PURE annotations work correctly in JS-generated code. In addition, as mentioned in the description, I verified that adding PURE to setEnumType in the TypeScript-generated code failed at runtime when trying to call getEnumType.

@smaye81 smaye81 requested a review from timostamm March 12, 2024 21:33
@timostamm
Copy link
Member

Verified that the PURE annotations work correctly in JS-generated code. In addition, as mentioned in the description, I verified that adding PURE to setEnumType in the TypeScript-generated code failed at runtime when trying to call getEnumType.

Thanks! Very useful to have this confirmed. Looks like we're now good to merge bufbuild/protobuf-es#470.

@smaye81 smaye81 merged commit ddd2d76 into main Mar 13, 2024
4 checks passed
@smaye81 smaye81 deleted the sayers/bundle_size_ts branch March 13, 2024 14:30
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