-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
test: Add Next 11 to integration tests #3741
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6a10902
test: Add Next 11 to integration tests
kamilogorek db3f015
Run tests only on supported node versions
kamilogorek f601430
Run both next versions on both webpack variants
kamilogorek 78e9bec
Solve eslint silliness
kamilogorek 62f64e1
Merge branch 'master' into next-11-integration-tests
kamilogorek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/types/global" /> | ||
/// <reference types="next/image-types/global" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { withSentryConfig } = require('@sentry/nextjs'); | ||
|
||
// NOTE: This will be used by integration tests to distinguish between Webpack 4 and Webpack 5 | ||
const moduleExports = { | ||
future: { | ||
webpack5: %RUN_WEBPACK_5%, | ||
}, | ||
}; | ||
|
||
const SentryWebpackPluginOptions = { | ||
dryRun: true, | ||
silent: true, | ||
}; | ||
|
||
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { withSentryConfig } = require('@sentry/nextjs'); | ||
|
||
// NOTE: This will be used by integration tests to distinguish between Webpack 4 and Webpack 5 | ||
const moduleExports = { | ||
webpack5: %RUN_WEBPACK_5%, | ||
eslint: { | ||
ignoreDuringBuilds: true, | ||
kamilogorek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
}; | ||
|
||
const SentryWebpackPluginOptions = { | ||
dryRun: true, | ||
silent: true, | ||
}; | ||
|
||
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
function cleanup { | ||
echo "[nextjs] Cleaning up..." | ||
mv next.config.js.bak next.config.js 2> /dev/null || true | ||
yarn remove next > /dev/null 2>&1 || true | ||
echo "[nextjs] Test run complete" | ||
} | ||
|
||
trap cleanup EXIT | ||
kamilogorek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
cd "$(dirname "$0")/integration" | ||
|
||
for NEXTJS_VERSION in 10 11; do | ||
NODE_VERSION=$(node -v) | ||
NODE_MAJOR=$(echo "$NODE_VERSION" | cut -c2- | cut -d. -f1) | ||
|
||
# Next 10 requires at least Node v10 | ||
if [ "$NODE_MAJOR" -lt "10" ]; then | ||
echo "[nextjs] Next.js is not compatible with versions of Node older than v10. Current version $NODE_VERSION" | ||
exit 0 | ||
fi | ||
|
||
# Next.js v11 requires at least Node v12 | ||
if [ "$NODE_MAJOR" -lt "12" ] && [ "$NEXTJS_VERSION" -eq "10" ]; then | ||
echo "[nextjs$NEXTJS_VERSION] Not compatible with Node $NODE_VERSION" | ||
exit 0 | ||
fi | ||
|
||
echo "[nextjs@$NEXTJS_VERSION] Running integration tests on $NODE_VERSION" | ||
|
||
echo "[nextjs@$NEXTJS_VERSION] Preparing environment..." | ||
mv next.config.js next.config.js.bak | ||
kamilogorek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
rm -rf node_modules .next .env.local 2> /dev/null || true | ||
|
||
echo "[nextjs@$NEXTJS_VERSION] Installing dependencies..." | ||
yarn --no-lockfile --silent > /dev/null 2>&1 | ||
yarn add "next@$NEXTJS_VERSION" > /dev/null 2>&1 | ||
|
||
for RUN_WEBPACK_5 in false true; do | ||
[ "$RUN_WEBPACK_5" == true ] && | ||
WEBPACK_VERSION=5 || | ||
WEBPACK_VERSION=4 | ||
|
||
if [ "$NEXTJS_VERSION" -eq "10" ]; then | ||
sed "s/%RUN_WEBPACK_5%/$RUN_WEBPACK_5/g" < next10.config.template > next.config.js | ||
else | ||
sed "s/%RUN_WEBPACK_5%/$RUN_WEBPACK_5/g" < next11.config.template > next.config.js | ||
fi | ||
|
||
echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Building..." | ||
yarn build | grep "Using webpack" | ||
|
||
EXIT_CODE=0 | ||
node test/server.js --silent || EXIT_CODE=$? | ||
if [ $EXIT_CODE -eq 0 ] | ||
then | ||
echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Server integration tests passed" | ||
else | ||
echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Server integration tests failed" | ||
exit 1 | ||
fi | ||
|
||
EXIT_CODE=0 | ||
node test/client.js --silent || EXIT_CODE=$? | ||
if [ $EXIT_CODE -eq 0 ] | ||
then | ||
echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Client integration tests passed" | ||
else | ||
echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Client integration tests failed" | ||
exit 1 | ||
fi | ||
done | ||
done; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.