diff --git a/packages/nextjs/test/integration/sentry.server.config.js b/packages/nextjs/test/integration/sentry.server.config.js index c8fcc45a2ae9..9df15d30523c 100644 --- a/packages/nextjs/test/integration/sentry.server.config.js +++ b/packages/nextjs/test/integration/sentry.server.config.js @@ -3,7 +3,19 @@ import * as Sentry from '@sentry/nextjs'; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', tracesSampleRate: 1, - integrations: [ + + integrations: defaults => [ + ...defaults.filter( + integration => + // filter out `Console` since the tests are happening in the console and we don't need to record what's printed + // there, because we can see it (this makes debug logging much less noisy, since intercepted events which are + // printed to the console no longer create console breadcrumbs, which then get printed, creating even longer + // console breadcrumbs, which get printed, etc, etc) + + // filter out `Http` so its options can be changed below (otherwise, default one wins because it's initialized first) + integration.name !== 'Console' && integration.name !== 'Http', + ), + // Used for testing http tracing new Sentry.Integrations.Http({ tracing: true }), ], diff --git a/packages/nextjs/test/integration/test/client/errorClick.js b/packages/nextjs/test/integration/test/client/errorClick.js index bec43d92a25e..373729007414 100644 --- a/packages/nextjs/test/integration/test/client/errorClick.js +++ b/packages/nextjs/test/integration/test/client/errorClick.js @@ -2,7 +2,6 @@ const { waitForAll } = require('../utils/common'); const { expectRequestCount, isEventRequest, expectEvent } = require('../utils/client'); module.exports = async ({ page, url, requests }) => { - console.log(page, url, requests); await page.goto(`${url}/errorClick`); await waitForAll([page.click('button'), page.waitForRequest(isEventRequest)]); diff --git a/packages/nextjs/test/integration/test/runner.js b/packages/nextjs/test/integration/test/runner.js index ae7a20e429cd..23eba29292c2 100644 --- a/packages/nextjs/test/integration/test/runner.js +++ b/packages/nextjs/test/integration/test/runner.js @@ -21,7 +21,7 @@ const argv = yargs(process.argv.slice(2)) }) .option('depth', { type: 'number', - description: 'Set the logging depth for intercepted requests', + description: 'Set the logging depth for intercepted requests (default = 4)', }).argv; const runScenario = async (scenario, execute, env) => { @@ -66,7 +66,7 @@ module.exports.run = async ({ let scenarios = await fs.readdir(scenariosDir); if (argv.filter) { - scenarios = scenarios.filter(file => file.toLowerCase().includes(argv.filter)); + scenarios = scenarios.filter(file => file.toLowerCase().includes(argv.filter.toLowerCase())); } scenarios = scenarios.map(s => path.resolve(scenariosDir, s)); diff --git a/packages/nextjs/test/integration/test/utils/common.js b/packages/nextjs/test/integration/test/utils/common.js index b831a8276f17..f8453ce075a9 100644 --- a/packages/nextjs/test/integration/test/utils/common.js +++ b/packages/nextjs/test/integration/test/utils/common.js @@ -37,7 +37,7 @@ const logIf = (condition, message, input, depth = 4) => { if (condition) { console.log(message); if (input) { - console.log(inspect(input, { depth })); + console.dir(input, { depth, colors: true }); } } }; diff --git a/packages/nextjs/test/integration/test/utils/server.js b/packages/nextjs/test/integration/test/utils/server.js index d9c037a79cad..5f761317024d 100644 --- a/packages/nextjs/test/integration/test/utils/server.js +++ b/packages/nextjs/test/integration/test/utils/server.js @@ -57,13 +57,14 @@ const objectMatches = (actual, expected) => { for (const key in expected) { const expectedValue = expected[key]; + const actualValue = actual[key]; if (Object.prototype.toString.call(expectedValue) === '[object Object]' || Array.isArray(expectedValue)) { - if (!objectMatches(actual[key], expectedValue)) { + if (!objectMatches(actualValue, expectedValue)) { return false; } } else { - if (actual[key] !== expectedValue) { + if (actualValue !== expectedValue) { return false; } } diff --git a/packages/nextjs/test/run-integration-tests.sh b/packages/nextjs/test/run-integration-tests.sh index f306825a5d97..fb4f186437bb 100755 --- a/packages/nextjs/test/run-integration-tests.sh +++ b/packages/nextjs/test/run-integration-tests.sh @@ -24,7 +24,7 @@ for NEXTJS_VERSION in 10 11; do fi # Next.js v11 requires at least Node v12 - if [ "$NODE_MAJOR" -lt "12" ] && [ "$NEXTJS_VERSION" -eq "10" ]; then + if [ "$NODE_MAJOR" -lt "12" ] && [ "$NEXTJS_VERSION" -eq "11" ]; then echo "[nextjs$NEXTJS_VERSION] Not compatible with Node $NODE_VERSION" exit 0 fi @@ -53,8 +53,19 @@ for NEXTJS_VERSION in 10 11; do echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Building..." yarn build | grep "Using webpack" + # if no arguments were passed, default to outputting nothing other than success and failure messages ($* gets all + # passed args as a single string) + args=$* + if [[ ! $args ]]; then + args="--silent" + fi + + # we keep this updated as we run the tests, so that if it's ever non-zero, we can bail EXIT_CODE=0 - node test/server.js --silent || EXIT_CODE=$? + + echo "Running server tests with options: $args" + node test/server.js $args || EXIT_CODE=$? + if [ $EXIT_CODE -eq 0 ] then echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Server integration tests passed" @@ -63,8 +74,8 @@ for NEXTJS_VERSION in 10 11; do exit 1 fi - EXIT_CODE=0 - node test/client.js --silent || EXIT_CODE=$? + echo "Running client tests with options: $args" + node test/client.js $args || EXIT_CODE=$? if [ $EXIT_CODE -eq 0 ] then echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Client integration tests passed"