forked from vercel/turborepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert examples tests to run through prysk (vercel#4000)
The advantage of running examples tests through prysk are: - isolated directory by default. don't need to setup a nested git repo - can run all tests in a single command (`.cram_env/bin/prysk example_tests/1) - matching the pattern with existing integration tests - set the pattern to add more sophisticated real-world integration tests against examples
- Loading branch information
Showing
14 changed files
with
110 additions
and
233 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
/scripts/turbo-* | ||
/.cram_env | ||
testbed | ||
integration_tests/**/*.t.err | ||
|
||
# Windows lib files | ||
turbo.h | ||
|
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh non-monorepo npm | ||
# run twice and make sure it works | ||
$ npx turbo build lint > /dev/null | ||
$ npx turbo build lint > /dev/null | ||
$ git diff |
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh with-npm npm | ||
# run twice and make sure it works | ||
$ npm run build lint > /dev/null | ||
$ npm run build lint > /dev/null | ||
$ git diff |
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh with-yarn npm | ||
# run twice and make sure it works | ||
$ npm run build lint > /dev/null | ||
$ npm run build lint > /dev/null | ||
$ git diff |
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh basic pnpm | ||
# run twice and make sure it works | ||
$ pnpm run build lint > /dev/null | ||
$ pnpm run build lint > /dev/null | ||
$ git diff |
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh kitchen-sink pnpm | ||
# run twice and make sure it works | ||
$ pnpm run build lint > /dev/null | ||
$ pnpm run build lint > /dev/null | ||
$ git diff |
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh with-svelte pnpm | ||
# run twice and make sure it works | ||
$ pnpm run build lint > /dev/null | ||
$ pnpm run build lint > /dev/null | ||
$ git diff |
This file contains 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,49 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
exampleName=$1 | ||
pkgManager=$2 | ||
|
||
# Copy the example dir over to the test dir that prysk puts you in | ||
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
EXAMPLE_DIR="../examples/$exampleName" | ||
TARGET_DIR="$(pwd)" | ||
cp -a "${SCRIPT_DIR}/$EXAMPLE_DIR/." "${TARGET_DIR}/" | ||
|
||
# cleanup lockfiles so we can install from scratch | ||
[ ! -f yarn.lock ] || mv yarn.lock yarn.lock.bak | ||
[ ! -f pnpm-lock.yaml ] || mv pnpm-lock.yaml pnpm-lock.yaml.bak | ||
[ ! -f package-lock.json ] || mv package-lock.json package-lock.json.bak | ||
|
||
# $TESTDIR is set by prysk to be the directory the test script is in | ||
# (not this setup.sh script, but it happens to be the same. | ||
SOURCE_TURBO_DIR="$TESTDIR/../cli" | ||
TURBO_VERSION_FILE="${SOURCE_TURBO_DIR}/../version.txt" | ||
# Change package.json in the example directory to point to @canary if our branch is currently at that version | ||
TURBO_TAG=$(cat "$TURBO_VERSION_FILE" | sed -n '2 p') | ||
if [ "$TURBO_TAG" == "canary" ]; then | ||
cat package.json | jq '.devDependencies.turbo = "canary"' | sponge package.json | ||
fi | ||
|
||
function set_package_manager() { | ||
cat package.json | jq ".packageManager=\"$1\"" | sponge package.json | ||
} | ||
|
||
# Set the packageManger version | ||
NPM_PACKAGE_MANAGER_VALUE="npm@8.1.2" | ||
PNPM_PACKAGE_MANAGER_VALUE="pnpm@6.26.1" | ||
YARN_PACKAGE_MANAGER_VALUE="yarn@1.22.17" | ||
if [ "$pkgManager" == "npm" ]; then | ||
set_package_manager "$NPM_PACKAGE_MANAGER_VALUE" | ||
npm install > /dev/null | ||
elif [ "$pkgManager" == "pnpm" ]; then | ||
set_package_manager "$PNPM_PACKAGE_MANAGER_VALUE" | ||
pnpm install > /dev/null | ||
elif [ "$pkgManager" == "yarn" ]; then | ||
set_package_manager "$YARN_PACKAGE_MANAGER_VALUE" | ||
yarn install > /dev/null | ||
fi | ||
|
||
# Delete .git directory if it's there, we'll set up a new git repo | ||
[ ! -d .git ] || rm -rf .git | ||
"${SCRIPT_DIR}/../cli/integration_tests/setup_git.sh" "${TARGET_DIR}" |
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh non-monorepo yarn | ||
# run twice and make sure it works | ||
$ npx turbo build lint > /dev/null | ||
$ npx turbo build lint > /dev/null | ||
$ git diff |
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh with-npm yarn | ||
# run twice and make sure it works | ||
$ yarn build lint > /dev/null | ||
$ yarn build lint > /dev/null | ||
$ git diff |
This file contains 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,5 @@ | ||
$ . ${TESTDIR}/setup.sh with-yarn yarn | ||
# run twice and make sure it works | ||
$ yarn turbo build lint > /dev/null | ||
$ yarn turbo build lint > /dev/null | ||
$ git diff |
This file contains 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