aboutsummaryrefslogtreecommitdiff
path: root/integration
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-02-10 03:30:30 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-02-10 03:30:30 -0800
commit25f15688f060fd7d3cbf9f47975c727c2d5eb5fb (patch)
treeb0fba575491824afebb18c9efe48b3bf581e9154 /integration
parent078a7c4c550887d71f3e432c9f5c4b0ad54b0c3b (diff)
downloadbun-25f15688f060fd7d3cbf9f47975c727c2d5eb5fb.tar.gz
bun-25f15688f060fd7d3cbf9f47975c727c2d5eb5fb.tar.zst
bun-25f15688f060fd7d3cbf9f47975c727c2d5eb5fb.zip
[bun dev] Add test for checking that js files are transpiled at the root when there is no static folder
Diffstat (limited to 'integration')
-rw-r--r--integration/apps/bun-dev-index-html.sh40
1 files changed, 26 insertions, 14 deletions
diff --git a/integration/apps/bun-dev-index-html.sh b/integration/apps/bun-dev-index-html.sh
index 44322eeec..ed8ec5912 100644
--- a/integration/apps/bun-dev-index-html.sh
+++ b/integration/apps/bun-dev-index-html.sh
@@ -8,44 +8,56 @@ 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="console.log('hi')"
+js_content="if(0) { var foo = 'TEST FAILED'; } console.log(<div>123</div> && console.log('hi'))"
+static_content="PASS"
echo $index_content >"$dir/index.html"
echo $js_content >"$dir/index.js"
echo $bacon_content >"$dir/bacon.html"
+echo $static_content >"$dir/static.txt"
cd $dir
-
$BUN_BIN --port 8087 &
sleep 0.005
-if [ "$(curl --fail http://localhost:8087/)" != "$index_content" ]; then
- echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/)'"
+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
-if [ "$(curl --fail http://localhost:8087/index)" != "$index_content" ]; then
- echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/index)'"
+# 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 http://localhost:8087/index.html)" != "$index_content" ]; then
- echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/index.html)'"
+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 http://localhost:8087/foo/foo)" != "$index_content" ]; then
- echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/index.html)'"
+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 http://localhost:8087/bacon)" != "$bacon_content" ]; then
- echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/bacon)'"
+if [ "$(curl --fail -sS http://localhost:8087/bacon)" != "$bacon_content" ]; then
+ echo "ERR: Expected '$index_content', got '$(curl --fail -sS http://localhost:8087/bacon)'"
exit 1
fi
-if [ "$(curl --fail http://localhost:8087/bacon.html)" != "$bacon_content" ]; then
- echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/bacon.html)'"
+if [ "$(curl --fail -sS http://localhost:8087/bacon.html)" != "$bacon_content" ]; then
+ echo "ERR: Expected '$index_content', got '$(curl --fail -sS http://localhost:8087/bacon.html)'"
exit 1
fi