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

ref(nextjs): Small changes to nextjs integration test runner #3819

Merged

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Jul 20, 2021

This PR makes a number of small tweaks to the integration test runner in @sentry/nextjs, mostly changes I made to help myself as I was trying to debug failing tests in another PR, either because they made the debugging itself easier or because they sped up the overall running of the test suite (in most cases by doing things only once instead of multiple times where possible).

Included changes:

  • Add a default version of nextjs to the integration test project’s dependencies. This makes it possible to call yarn (and yarn build) out of the context of the test runner script (specifically, when using a debugger).

  • Add a VSCode debug profile for nextjs integration tests.

  • Speed up initial setup by only having yarn install packages once per version of next (instead of once to install all non-nextjs packages, and again when adding the specific version of next).

  • Back up next.config.js outside of the loops, so we’re guaranteed to restore from the original.

  • As part of cleanup, nuke all of node_modules rather than just removing nextjs (we’re going to delete node_modules before the next run anyway, and this way yarn doesn’t go through yet another install process on its way out the door).

  • Also as part of cleanup, remove all files added to the yarn cache as a result of this test run, in order to prevent the cache from growing arbitrarily large.

  • Only run check on node version once, since it’s the same across all loops.

  • Label each event/transaction/session displayed (when using --debug on server tests) with the name of the test it's from.

  • 
Remove test for tracing 404s, since it the underlying code doesn’t actually work on its own (this is okay; we don’t capture 404s in any other framework).

  • Make some formatting changes (as insisted upon by the auto-formatter).

  • Add some comments and clean up logging a little bit.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 20, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 21.46 KB (+0.01% 🔺)
@sentry/browser - Webpack 22.47 KB (0%)
@sentry/react - Webpack 22.5 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.97 KB (0%)

# Delete yarn's cached versions of sentry packages added during this test run, since every test run installs multiple
# copies of each package. Without this, the cache can balloon in size quickly if integration tests are being run
# multiple times in a row.
find $(yarn cache dir) -iname "npm-@sentry*" -newermt "$START_TIME" -mindepth 1 -maxdepth 1 -exec rm -rf {} \;
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor

@kamilogorek kamilogorek left a comment

Choose a reason for hiding this comment

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

Beautiful

@lobsterkatie lobsterkatie merged commit 50526a3 into master Jul 20, 2021
@lobsterkatie lobsterkatie deleted the kmclb-nextjs-more-integration-test-fixes-july-2021 branch July 20, 2021 13:24
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