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

build: Move build related unit test into own job #4658

Merged
merged 6 commits into from
Mar 3, 2022

Conversation

AbhiPrasad
Copy link
Member

We shouldn't be asserting on built assets (dist/esm) in our unit tests.

This helps unblock #4616

We shouldn't be asserting on built assets (dist/esm) in our unit tests.

This helps unblock #4616
@AbhiPrasad AbhiPrasad requested review from a team, Lms24 and lobsterkatie and removed request for a team March 1, 2022 17:46
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

size-limit report

Path Base Size (0b2221d) Current Size Change
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.79 KB 19.79 KB -0.01% 🔽
@sentry/browser - ES5 CDN Bundle (minified) 63.39 KB 63.39 KB 0%
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.44 KB 18.44 KB 0%
@sentry/browser - ES6 CDN Bundle (minified) 56.42 KB 56.42 KB 0%
@sentry/browser - Webpack (gzipped + minified) 22.25 KB 22.25 KB 0%
@sentry/browser - Webpack (minified) 76.34 KB 76.34 KB 0%
@sentry/react - Webpack (gzipped + minified) 22.28 KB 22.28 KB 0%
@sentry/nextjs Client - Webpack (gzipped + minified) 46.43 KB 46.43 KB 0%
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.68 KB 26.68 KB 0%

Copy link
Member

@lobsterkatie lobsterkatie left a comment

Choose a reason for hiding this comment

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

Wow. TIL that these tests even exist (both on the browser side and the utils side).

Two things:

  1. The utils test is really a types test, to make sure we're not including node types where we shouldn't be. Could we call it test/types/build.js, or even test/types/index.js since there's unlikely to ever be more than one file in that folder? (I think package is kind of ambiguous.)

  2. Out of the scope of this PR, but I wonder if the browser tests are even still necessary, now that we run all of our browser integration tests against all of our bundles.

@AbhiPrasad
Copy link
Member Author

Solid diligence on the review - I hastly put this together to unblock, but I maybe should have made that more clear.

I'll make the changes for test/types/index.js - it does express clarity better here.

Out of the scope of this PR, but I wonder if the browser tests are even still necessary, now that we run all of our browser integration tests against all of our bundles.

We can easily migrate this part

const scriptEl = window.document.createElement('script');
scriptEl.textContent = myLibrary;
window.document.body.appendChild(scriptEl);
// Testing https://github.com/getsentry/sentry-javascript/issues/2043
const scriptEl2 = window.document.createElement('script');
scriptEl2.textContent = myLibrary;
window.document.body.appendChild(scriptEl2);
// ------------------------------------------------------------------
, but
if (myLibrary.indexOf('tslib_1__default') !== -1) {
console.log('"tslib_1__default" reappeared...');
process.exit(1);
}
will probably need to live in a similar set up.

@lobsterkatie
Copy link
Member

Oh, yeah. I'll admit that as far as the browser tests are concerned, I skimmed it, thought, "Oh, okay, it's just testing that the built bundle does the normal sentry stuff," and moved on. Now you’re the one doing the due diligence!

At some point we might look back at any parts of that which aren't just testing that the built bundle does a thing (superseded by Onur's recent work, IMHO) to see if all of them are even still relevant, but not urgent.

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) March 3, 2022 13:27
@AbhiPrasad AbhiPrasad merged commit bc7b975 into master Mar 3, 2022
@AbhiPrasad AbhiPrasad deleted the abhi-move-build-tests branch March 3, 2022 14:35
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.

None yet

3 participants