blob: 25432c4227faebcee5b52525ba83f4bf4f7db4d4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/usr/bin/env bash
# TODO: move this test to bun once we have a child_process equivalent.
(killall -9 $(basename $BUN_BIN) || echo "") >/dev/null 2>&1
# https://github.com/oven-sh/bun/issues/40
# Define a function (details aren't important)
fn() { :; }
# The important bit: export the function
export -f fn
rm -rf /tmp/bun-run-check
mkdir -p /tmp/bun-run-check
cp ./bun-run-check-package.json /tmp/bun-run-check/package.json
cd /tmp/bun-run-check
$BUN_BIN run bash -- -c ""
if (($?)); then
echo "Bash exported functions are broken"
exit 1
fi
# We need to run these tests for two variations:
# bun run foo "bar"
# bun run foo -- "bar"
# the "--" should be ignored
# in earlier versions of bun, it was required to be present
$BUN_BIN run bash -c ""
if (($?)); then
echo "Bash exported functions are broken"
exit 1
fi
# https://github.com/oven-sh/bun/issues/53
rm -f /tmp/bun-run-out.expected.txt /tmp/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
cmp -s /tmp/bun-run-out.expected.txt /tmp/bun-run-out.txt
if (($?)); then
echo "argv failed"
exit 1
fi
rm -f /tmp/bun-run-out.expected.txt /tmp/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
cmp -s /tmp/bun-run-out.expected.txt /tmp/bun-run-out.txt
if (($?)); then
echo "argv failed"
exit 1
fi
$BUN_BIN run --silent this-should-work
if (($?)); then
echo "this-should work failed"
exit 1
fi
exit 0
|