diff options
Diffstat (limited to 'test/apps')
-rw-r--r-- | test/apps/bun-create-next.sh | 23 | ||||
-rw-r--r-- | test/apps/bun-create-react.sh | 13 | ||||
-rw-r--r-- | test/apps/bun-dev-index-html.sh | 18 | ||||
-rw-r--r-- | test/apps/bun-dev.sh | 14 | ||||
-rw-r--r-- | test/apps/bun-install-lockfile-status.sh | 6 | ||||
-rw-r--r-- | test/apps/bun-install-utf8.sh | 6 | ||||
-rw-r--r-- | test/apps/bun-install.sh | 10 | ||||
-rw-r--r-- | test/apps/bun-run-check.sh | 19 |
8 files changed, 55 insertions, 54 deletions
diff --git a/test/apps/bun-create-next.sh b/test/apps/bun-create-next.sh index 4f19e535d..110351d97 100644 --- a/test/apps/bun-create-next.sh +++ b/test/apps/bun-create-next.sh @@ -4,21 +4,20 @@ set -euo pipefail # The important part of this test: make sure that bun.js successfully loads # The most likely reason for this test to fail is that something broke in the JavaScriptCore <> bun integration -killall -9 $(basename $BUN_BIN) || echo "" +killall -9 "$(basename "$BUN_BIN")" || echo "" -rm -rf /tmp/next-app -mkdir -p /tmp/next-app -$BUN_BIN create next /tmp/next-app +DIR=$(mktemp -d -t next-app) +$BUN_BIN create next "$DIR" if (($?)); then echo "bun create failed" exit 1 fi -echo "hi!" >/tmp/next-app/public/file.txt -echo "export default 'string';" >/tmp/next-app/file.js +echo "hi!" >"$DIR/public/file.txt" +echo "export default 'string';" >"$DIR/file.js" -cd /tmp/next-app +cd "$DIR" BUN_CRASH_WITHOUT_JIT=1 $BUN_BIN dev --port 8087 & sleep 0.1 curl --fail -Ss http://localhost:8087/ @@ -28,7 +27,7 @@ if [[ "$(curl --fail -sS http://localhost:8087/file.txt)" != "hi!" ]]; then echo "" echo "" echo "ERR: Expected 'hi!', got '$(curl --fail -sS http://localhost:8087/file.txt)'" - killall -9 $(basename $BUN_BIN) || echo "" + killall -9 "$(basename "$BUN_BIN")" || echo "" exit 1 fi @@ -37,12 +36,12 @@ if [[ "$(curl --fail -sS http://localhost:8087/file.js)" != *"string"* ]]; then echo "" echo "" echo "ERR: Expected file to contain string got '$(curl --fail -sS http://localhost:8087/file.js)'" - killall -9 $(basename $BUN_BIN) || echo "" + killall -9 "$(basename "$BUN_BIN")" || echo "" exit 1 fi # very simple HMR test -echo "export default 'string';" >/tmp/next-app/file2.js +echo "export default 'string';" >"$DIR/file2.js" sleep 0.1 if [[ "$(curl --fail -sS http://localhost:8087/file2.js)" != *"string"* ]]; then @@ -50,8 +49,8 @@ if [[ "$(curl --fail -sS http://localhost:8087/file2.js)" != *"string"* ]]; then echo "" echo "" echo "ERR: Expected file to contain string got '$(curl --fail -sS http://localhost:8087/file2.js)'" - killall -9 $(basename $BUN_BIN) || echo "" + killall -9 "$(basename "$BUN_BIN")" || echo "" exit 1 fi -killall -9 $(basename $BUN_BIN) || echo "" +killall -9 "$(basename "$BUN_BIN")" || echo "" diff --git a/test/apps/bun-create-react.sh b/test/apps/bun-create-react.sh index 41552dee5..e903b3f65 100644 --- a/test/apps/bun-create-react.sh +++ b/test/apps/bun-create-react.sh @@ -1,19 +1,20 @@ #!/bin/bash -killall -9 $(basename $BUN_BIN) || echo "" +set -euo pipefail -rm -rf /tmp/react-app -mkdir -p /tmp/react-app -$BUN_BIN create react /tmp/react-app +killall -9 "$(basename "$BUN_BIN")" || echo "" + +DIR=$(mktemp -d -t react-app) +$BUN_BIN create react "$DIR" if (($?)); then echo "bun create failed" exit 1 fi -cd /tmp/react-app +cd "$DIR" BUN_CRASH_WITHOUT_JIT=1 $BUN_BIN dev --port 8087 & sleep 0.005 -curl --fail http://localhost:8087/ && curl --fail http://localhost:8087/src/index.jsx && killall -9 $(basename $BUN_BIN) && echo "✅ bun create react passed." +curl --fail http://localhost:8087/ && curl --fail http://localhost:8087/src/index.jsx && killall -9 "$(basename "$BUN_BIN")" && echo "✅ bun create react passed." exit $? diff --git a/test/apps/bun-dev-index-html.sh b/test/apps/bun-dev-index-html.sh index 01d99b71a..2cabb798b 100644 --- a/test/apps/bun-dev-index-html.sh +++ b/test/apps/bun-dev-index-html.sh @@ -2,9 +2,9 @@ set -euo pipefail -killall -9 $(basename $BUN_BIN) || echo "" +killall -9 "$(basename "$BUN_BIN")" || echo "" -dir=$(mktemp -d --suffix=bun-dev-check) +DIR=$(mktemp -d -t bun-dev-check) index_content="<html><body>index.html</body></html>" bacon_content="<html><body>bacon.html</body></html>" @@ -14,13 +14,13 @@ css_not_transpiled_content="@import url(/index.js); @import url(/i-dont-exist.cs css_is_transpiled_import="*{background-color:red;}" css_is_transpiled="@import url(./css_is_transpiled_import.css);" -echo $index_content >"$dir/index.html" -echo $js_content >"$dir/index.js" -echo $bacon_content >"$dir/bacon.html" -echo $static_content >"$dir/static.txt" -echo $css_not_transpiled_content >"$dir/css_not_transpiled_content.css" +echo $index_content >"$DIR/index.html" +echo $js_content >"$DIR/index.js" +echo $bacon_content >"$DIR/bacon.html" +echo $static_content >"$DIR/static.txt" +echo $css_not_transpiled_content >"$DIR/css_not_transpiled_content.css" -cd $dir +cd "$DIR" $BUN_BIN dev --port 8087 & sleep 0.005 @@ -65,5 +65,5 @@ if [[ "$(curl --fail -sS http://localhost:8087/bacon.html)" != "$bacon_content" exit 1 fi -killall -9 $(basename $BUN_BIN) || echo "" +killall -9 "$(basename "$BUN_BIN")" || echo "" echo "✅ bun dev index html check passed." diff --git a/test/apps/bun-dev.sh b/test/apps/bun-dev.sh index fd2447e93..485edd69a 100644 --- a/test/apps/bun-dev.sh +++ b/test/apps/bun-dev.sh @@ -2,21 +2,21 @@ set -euo pipefail -killall -9 $(basename $BUN_BIN) || echo "" +killall -9 "$(basename "$BUN_BIN")" || echo "" -dir=$(mktemp -d --suffix=bun-dev-check) +DIR=$(mktemp -d -t bun-dev-check) index_content="<html><body>index.html</body></html>" bacon_content="<html><body>bacon.html</body></html>" js_content="console.log('hi')" -mkdir -p $dir/public +mkdir -p "$DIR/public" -echo $index_content >"$dir/public/index.html" -echo $js_content >"$dir/index.js" -echo $bacon_content >"$dir/public/bacon.html" +echo $index_content >"$DIR/public/index.html" +echo $js_content >"$DIR/index.js" +echo $bacon_content >"$DIR/public/bacon.html" -cd $dir +cd "$DIR" $BUN_BIN dev --port 8087 & sleep 0.005 diff --git a/test/apps/bun-install-lockfile-status.sh b/test/apps/bun-install-lockfile-status.sh index b23b4fc3c..de8a4a8f2 100644 --- a/test/apps/bun-install-lockfile-status.sh +++ b/test/apps/bun-install-lockfile-status.sh @@ -2,11 +2,11 @@ set -euo pipefail -killall -9 $(basename $BUN_BIN) || echo "" +killall -9 "$(basename "$BUN_BIN")" || echo "" -dir=$(mktemp -d --suffix=bun-lockfile) +DIR=$(mktemp -d -t bun-lockfile) -cd $dir +cd "$DIR" $BUN_BIN add react diff --git a/test/apps/bun-install-utf8.sh b/test/apps/bun-install-utf8.sh index 66783cb50..263eade6a 100644 --- a/test/apps/bun-install-utf8.sh +++ b/test/apps/bun-install-utf8.sh @@ -2,11 +2,11 @@ set -euo pipefail -killall -9 $(basename $BUN_BIN) || echo "" +killall -9 "$(basename "$BUN_BIN")" || echo "" -dir=$(mktemp -d --suffix=bun-ADD) +DIR=$(mktemp -d -t bun-ADD) -cd $dir +cd "$DIR" # https://github.com/Jarred-Sumner/bun/issues/115 echo '{ "author": "Arnaud Barré (https://github.com/ArnaudBarre)" }' >package.json diff --git a/test/apps/bun-install.sh b/test/apps/bun-install.sh index dd4083e33..adc69fec3 100644 --- a/test/apps/bun-install.sh +++ b/test/apps/bun-install.sh @@ -2,9 +2,9 @@ set -euo pipefail -dir=$(mktemp -d --suffix=bun-install-test-1) +DIR=$(mktemp -d -t bun-install-test-1) -cd $dir +cd "$DIR" ${NPM_CLIENT:-$(which bun)} add react react-dom @types/react @babel/parser esbuild echo "console.log(typeof require(\"react\").createElement);" >index.js @@ -47,7 +47,7 @@ fi ${NPM_CLIENT:-$(which bun)} remove react-dom if [ -d "node_modules/react-dom" ]; then - echo "ERR: react-dom module still exists in $dir" + echo "ERR: react-dom module still exists in $DIR" exit 1 fi @@ -68,14 +68,14 @@ if echo "$yarn_dot_lock" | grep -q "@types/react"; then fi if echo "$yarn_dot_lock" | grep -q "@types/react"; then - echo "ERR: @types/react module still exists in $dir" + echo "ERR: @types/react module still exists in $DIR" exit 1 fi ${NPM_CLIENT:-$(which bun)} remove react if [ -d "node_modules/react" ]; then - echo "ERR: react module still exists in $dir" + echo "ERR: react module still exists in $DIR" exit 1 fi diff --git a/test/apps/bun-run-check.sh b/test/apps/bun-run-check.sh index dca1db6ae..decfb2896 100644 --- a/test/apps/bun-run-check.sh +++ b/test/apps/bun-run-check.sh @@ -1,6 +1,8 @@ #!/bin/bash -(killall -9 $(basename $BUN_BIN) || echo "") >/dev/null 2>&1 +set -euo pipefail + +(killall -9 "$(basename "$BUN_BIN")" || echo "") >/dev/null 2>&1 # https://github.com/Jarred-Sumner/bun/issues/40 # Define a function (details aren't important) @@ -8,11 +10,10 @@ fn() { :; } # The important bit: export the function export -f fn -rm -rf /tmp/bun-run-check -mkdir -p /tmp/bun-run-check +DIR=$(mktemp -d -t bun-run-check) -cp ./bun-run-check-package.json /tmp/bun-run-check/package.json -cd /tmp/bun-run-check +cp ./bun-run-check-package.json "$DIR/package.json" +cd "$DIR" $BUN_BIN run bash -- -c "" @@ -22,12 +23,12 @@ if (($?)); then fi # https://github.com/Jarred-Sumner/bun/issues/53 -rm -f /tmp/bun-run-out.expected.txt /tmp/bun-run-out.txt >/dev/null 2>&1 +rm -f "$DIR/bun-run-out.expected.txt" "$DIR/bun-run-out.txt" >/dev/null 2>&1 -$BUN_BIN run --silent argv -- foo bar baz >/tmp/bun-run-out.txt -npm run --silent argv -- foo bar baz >/tmp/bun-run-out.expected.txt +$BUN_BIN run --silent argv -- foo bar baz > "$DIR/bun-run-out.txt" +npm run --silent argv -- foo bar baz > "$DIR/bun-run-out.expected.txt" -cmp -s /tmp/bun-run-out.expected.txt /tmp/bun-run-out.txt +cmp -s "$DIR/bun-run-out.expected.txt" "$DIR/bun-run-out.txt" if (($?)); then echo "argv failed" exit 1 |