aboutsummaryrefslogtreecommitdiff
path: root/test/apps/bun-dev-index-html.sh
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-22 23:21:48 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-22 23:21:48 -0700
commit729d445b6885f69dd2c6355f38707bd42851c791 (patch)
treef87a7c408929ea3f57bbb7ace380cf869da83c0e /test/apps/bun-dev-index-html.sh
parent25f820c6bf1d8ec6d444ef579cc036b8c0607b75 (diff)
downloadbun-729d445b6885f69dd2c6355f38707bd42851c791.tar.gz
bun-729d445b6885f69dd2c6355f38707bd42851c791.tar.zst
bun-729d445b6885f69dd2c6355f38707bd42851c791.zip
change the directory structurejarred/rename
Diffstat (limited to 'test/apps/bun-dev-index-html.sh')
-rw-r--r--test/apps/bun-dev-index-html.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/apps/bun-dev-index-html.sh b/test/apps/bun-dev-index-html.sh
new file mode 100644
index 000000000..eef41f78b
--- /dev/null
+++ b/test/apps/bun-dev-index-html.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+set -euo pipefail
+
+killall -9 $(basename $BUN_BIN) || echo ""
+
+dir=$(mktemp -d --suffix=bun-dev-check)
+
+index_content="<html><body>index.html</body></html>"
+bacon_content="<html><body>bacon.html</body></html>"
+js_content="if(0) { var foo = 'TEST FAILED'; }"
+static_content="PASS"
+css_not_transpiled_content="@import url(/index.js); @import url(/i-dont-exist.css); @import url('/i-dont-exist.css'); @import url(\"/i-dont-exist.css\");"
+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"
+
+cd $dir
+$BUN_BIN --port 8087 &
+sleep 0.005
+
+if [[ "$(curl --fail -sS http://localhost:8087/)" != "$index_content" ]]; then
+ echo "ERR: Expected '$index_content', got '$(curl --fail -sS http://localhost:8087/)'"
+ exit 1
+fi
+
+if [[ "$(curl --fail -sS http://localhost:8087/index)" != "$index_content" ]]; then
+ echo "ERR: Expected '$index_content', got '$(curl --fail -sS http://localhost:8087/index)'"
+ exit 1
+fi
+
+if [[ "$(curl --fail -sS http://localhost:8087/static.txt)" != "PASS" ]]; then
+ echo "ERR: Expected static file, got '$(curl --fail -sS http://localhost:8087/static.txt)'"
+ exit 1
+fi
+
+# Check that the file is actually transpiled
+if [[ "$(curl --fail -sS http://localhost:8087/index.js)" == *"TEST FAILED"* ]]; then
+ echo "ERR: Expected file to be transpiled, got '$(curl --fail -sS http://localhost:8087/index.js)'"
+ exit 1
+fi
+
+if [[ "$(curl --fail -sS http://localhost:8087/index.html)" != "$index_content" ]]; then
+ echo "ERR: Expected '$index_content', got '$(curl --fail -sS http://localhost:8087/index.html)'"
+ exit 1
+fi
+
+if [[ "$(curl --fail -sS http://localhost:8087/foo/foo)" != "$index_content" ]]; then
+ echo "ERR: Expected '$index_content', got '$(curl --fail -sS http://localhost:8087/index.html)'"
+ exit 1
+fi
+
+if [[ "$(curl --fail -sS http://localhost:8087/bacon)" != "$bacon_content" ]]; then
+ echo "ERR: Expected '$bacon_content', got '$(curl --fail -sS http://localhost:8087/bacon)'"
+ exit 1
+fi
+
+if [[ "$(curl --fail -sS http://localhost:8087/bacon.html)" != "$bacon_content" ]]; then
+ echo "ERR: Expected '$bacon_content', got '$(curl --fail -sS http://localhost:8087/bacon.html)'"
+ exit 1
+fi
+
+killall -9 $(basename $BUN_BIN) || echo ""
+echo "✅ bun dev index html check passed."
nstall-lockfile-status.shGravatar Jarred Sumner 1-9/+2 2022-02-25[bun install] Add metadata hashGravatar Jarred Sumner 9-19/+277 2022-02-25Update README.md (#119)Gravatar Evan Boehs 1-1/+0 2022-02-24[bun install] Skip saving the lockfile if there are no changesGravatar Jarred Sumner 3-12/+97 2022-02-24Update MakefileGravatar Jarred Sumner 1-1/+1 2022-02-24Update MakefileGravatar Jarred Sumner 1-1/+0 2022-02-24Update WebKitGravatar Jarred Sumner 1-0/+0 2022-02-24Update generated versionsGravatar Jarred Sumner 1-2/+2 2022-02-24Update MakefileGravatar Jarred Sumner 1-1/+3 2022-02-24miscGravatar Jarred Sumner 2-4/+4 2022-02-24[bun dev] Don't log errors twiceGravatar Jarred Sumner 1-1/+0 2022-02-24Add a simple HMR testGravatar Jarred Sumner 1-2/+40 2022-02-24Make alignment more consitentGravatar Jarred Sumner 3-4/+56 2022-02-24[bun dev] Fix bug with not transpiling files at the rootGravatar Jarred Sumner 2-21/+47 2022-02-24slightly clean up react exampleGravatar Jarred Sumner 5-55/+2 2022-02-24[bun-framework-next] Support Next.js 12.1Gravatar Jarred Sumner 6-25/+46 2022-02-24[bun.js] Implement `process.exit` (no callbacks yet)Gravatar Jarred Sumner 2-0/+29 2022-02-24[bun install] Print correct bin nameGravatar Jarred Sumner 1-1/+1 2022-02-24[bun install] Add integration test for bin linksGravatar Jarred Sumner 1-1/+7 2022-02-24Add WASM modules but disable it for nowGravatar Jarred Sumner 28-134/+530 2022-02-24bump build idGravatar Jarred Sumner 1-1/+1 2022-02-24fix test failure in path.resolveGravatar Jarred Sumner 1-2/+6 2022-02-24Ensure we run the process testGravatar Jarred Sumner 2-48/+54 2022-02-24Update javascript.zigGravatar Jarred Sumner 1-1/+110 2022-02-24[bun.js] Add `ShadowRealm`Gravatar Jarred Sumner 7-18/+70 2022-02-24[bun-framework-next] Remove TextEncoder & TextDecoder polyfillsGravatar Jarred Sumner 3-340/+19 2022-02-24Use a JSFinalobject for PathGravatar Jarred Sumner 2-81/+42 2022-02-24Expose TextEncoder & TextDecoder globallyGravatar Jarred Sumner 3-20/+750 2022-02-24[Web Platform] Implement TextEncoder & TextDecoderGravatar Jarred Sumner 12-358/+1044 2022-02-24move GCDeferralContextGravatar Jarred Sumner 2-18/+24 2022-02-24[JS Parser] ensure assertions are never run at runtimeGravatar Jarred Sumner 1-13/+18 2022-02-24misc cleanupGravatar Jarred Sumner 2-7/+18 2022-02-22Make format consistent with WebKitGravatar Jarred Sumner 20-3596/+4110 2022-02-22import assertion testGravatar Jarred Sumner 1-0/+33 2022-02-22snaspshotsGravatar Jarred Sumner 42-94/+113