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

feat: Hard fail on invalid bundle names #136

Merged
merged 10 commits into from
May 27, 2024

Conversation

nicholas-codecov
Copy link
Collaborator

Description

This PR updates the plugins to hard fail when a user passes an invalid bundle name, exiting the process. This is a small change, but should really help people when setting up the bundler plugins if they're not getting any data in Codecov but still seeing checkmarks across their CI.

Closes #124

Notable Changes

  • Add in new handleErrors function the plugin core
  • Use new function in the various plugins
  • Add in integration tests

Copy link

codecov bot commented May 27, 2024

Codecov Report

Attention: Patch coverage is 48.61111% with 37 lines in your changes are missing coverage. Please review.

Project coverage is 77.75%. Comparing base (91e933f) to head (abbbcdd).

✅ All tests successful. No failed tests found.

Files Patch % Lines
packages/bundler-plugin-core/src/index.ts 0.00% 11 Missing ⚠️
packages/vite-plugin/src/index.ts 0.00% 6 Missing ⚠️
packages/nuxt-plugin/src/index.ts 0.00% 5 Missing ⚠️
packages/rollup-plugin/src/index.ts 0.00% 5 Missing ⚠️
packages/sveltekit-plugin/src/index.ts 0.00% 5 Missing ⚠️
packages/webpack-plugin/src/index.ts 0.00% 5 Missing ⚠️
Additional details and impacted files
Components Coverage Δ
Plugin core 97.68% <76.08%> (-0.19%) ⬇️
Rollup plugin 10.37% <0.00%> (-0.08%) ⬇️
Vite plugin 10.52% <0.00%> (-0.08%) ⬇️
Webpack plugin 26.04% <0.00%> (-0.16%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codecov bot commented May 27, 2024

Bundle Report

Changes will increase total bundle size by 1.04kB ⬆️

Bundle name Size Change
@codecov/sveltekit-plugin-cjs 1.32kB 25 bytes ⬆️
@codecov/nuxt-plugin-cjs 1.4kB 25 bytes ⬆️
@codecov/sveltekit-plugin-esm 909 bytes 0 bytes
@codecov/nuxt-plugin-esm 855 bytes 0 bytes
@codecov/vite-plugin-cjs 2.96kB 34 bytes ⬆️
@codecov/example-rollup-app-iife 95.45kB 0 bytes
@codecov/vite-plugin-esm 1.26kB 0 bytes
@codecov/bundler-plugin-core-cjs 42.09kB 146 bytes ⬆️
@codecov/example-next-app-server-cjs 342.32kB 0 bytes
@codecov/bundler-plugin-core-esm 7.32kB 760 bytes ⬆️
@codecov/example-next-app-edge-server-array-push 354 bytes 0 bytes
@codecov/rollup-plugin-cjs 2.96kB 25 bytes ⬆️
@codecov/webpack-plugin-cjs 3.59kB 25 bytes ⬆️
@codecov/rollup-plugin-esm 1.32kB 0 bytes
@codecov/webpack-plugin-esm 1.44kB 0 bytes
@codecov/example-next-app-client-array-push 907.85kB 0 bytes
@codecov/example-webpack-app-array-push 71.19kB 0 bytes
@codecov/example-vite-app-esm 150.61kB 0 bytes

*
* @param {NormalizedOptionsFailure} options - The normalized options that failed validation.
*/
export const handleErrors = (options: NormalizedOptionsFailure) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this leads to some duplicate code, but I never like process exits as a side effect to a function like this.

Instead can we return a boolean shouldExit from this function? Then the consumer of this function calls process.exit so it's very clear to readers when an exit happens?

this is just my opinion though, so feel free to disregard, doesn't block.

Copy link
Collaborator Author

@nicholas-codecov nicholas-codecov May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be a big fan of throw/try/catch then 😉

Ouu I really like this, updating now.

@nicholas-codecov nicholas-codecov merged commit d74a176 into main May 27, 2024
33 of 35 checks passed
@nicholas-codecov nicholas-codecov deleted the gh-cjbp-124-hard-fail-on-invalid-bundle-names branch May 27, 2024 17:25
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.

Hard Fail on invalid bundle name
2 participants