You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ref(nextjs): Improve integration test debugging (#4144)
This includes two changes I made to help myself while debugging the nextjs integration tests for a recent PR:
1) Add the ability to set `debug: true` in `Sentry.init()` via a command line flag. In order to do this, I changed the `--debug` flag from a boolean to one which can appear multiple times and which accepts an optional string, either `requests` or `logs`, with the following behavior:
- `yarn test:integration` -> no debug logging of any kind (matches current behavior)
- `yarn test:integration --debug` -> sets `debug: true` in `Sentry.init()` (change in behavior)
- `yarn test:integration --debug logs` -> sets `debug: true` in `Sentry.init()` (change in behavior)
- `yarn test:integration --debug requests` -> logs intercepted requests (current behavior of `--debug` flag)
I chose to make SDK debug logging the default (what you get if you just use `--debug` without an argument) because of the two options, it is significantly more useful in my experience. (Logging intercepted requests gets unwieldy fast, as they are large objects and end up just creating a lot of noise to sift through in order to find the one piece of data you might want.) Since bare `--debug` has up until now logged intercepted requests, this is technically a breaking change, but since these tests have a userbase of under 5 people, all of them on our team, I figured we could probably roll with it. :-)
2) Improve the VSCode debugger setup for the integration tests. This involved:
- Adding a bash function to link sentry packages into the test app, so that we can test against any changes we make without having to reinstall all of the test app's dependencies again just to use the updated files.
- Creating a task to be executed before each run of the debugger, which uses the above script to link monorepo packages (if not already linked) and then rebuilds the test app. (This happens by calling a new `yarn` script.)
- Setting up the debugger's sourcemap config, so we can step through TS files rather than the generated JS files.
- Adding more comments to the debug config to explain what each bit does and why.
0 commit comments