Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions packages/nextjs/test/integration_test_utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
function link_package() {
local package_abs_path=$1
local package_name=$2

echo "Setting up @sentry/${package_name} for linking"
pushd $package_abs_path
yarn link
popd

echo "Linking @sentry/$package_name"
yarn link "@sentry/$package_name"

}

# Note: LINKED_CLI_REPO and LINKED_PLUGIN_REPO in the functions below should be set to the absolute path of each local repo

function linkcli() {
if [[ ! $LINKED_CLI_REPO ]]; then
return
fi

# check to make sure the repo directory exists
if [[ -d $LINKED_CLI_REPO ]]; then
link_package $LINKED_CLI_REPO "cli"
else
# the $1 lets us insert a string in that spot if one is passed to `linkcli` (useful for when we're calling this from
# within another linking function)
echo "ERROR: Can't link @sentry/cli $1because directory $LINKED_CLI_REPO does not exist."
fi
}

function linkplugin() {
if [[ ! $LINKED_PLUGIN_REPO ]]; then
return
fi

# check to make sure the repo directory exists
if [[ -d $LINKED_PLUGIN_REPO ]]; then
link_package $LINKED_PLUGIN_REPO "webpack-plugin"

# the webpack plugin depends on `@sentry/cli`, so if we're also using a linked version of the cli package, the
# plugin needs to link to it, too
if [[ $LINKED_CLI_REPO ]]; then
pushd $LINKED_PLUGIN_REPO
link_cli "in webpack plugin repo "
popd
fi
else
echo "ERROR: Can't link @sentry/wepack-plugin because $LINKED_PLUGIN_REPO does not exist."
fi
}
8 changes: 7 additions & 1 deletion packages/nextjs/test/run-integration-tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

source test/integration_test_utils.sh

set -e

START_TIME=$(date -R)
Expand Down Expand Up @@ -55,6 +57,9 @@ for NEXTJS_VERSION in 10 11; do
sed -i /"next.*latest"/s/latest/"${NEXTJS_VERSION}.x"/ package.json
fi
yarn --no-lockfile --silent >/dev/null 2>&1
# if applicable, use local versions of `@sentry/cli` and/or `@sentry/webpack-plugin` (these commands no-op unless
# LINKED_CLI_REPO and/or LINKED_PLUGIN_REPO is set)
linkcli && linkplugin
mv -f package.json.bak package.json 2>/dev/null || true

for RUN_WEBPACK_5 in false true; do
Expand All @@ -72,9 +77,10 @@ for NEXTJS_VERSION in 10 11; do
echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Building..."
yarn build | grep "Using webpack"

# if the user hasn't passed any args, use the default one, which restricts each test to only outputting success and
# failure messages
args=$*
if [[ ! $args ]]; then
# restrict each test to only output success and failure messages
args="--silent"
fi

Expand Down