diff options
author | 2022-02-24 22:01:37 -0800 | |
---|---|---|
committer | 2022-02-24 22:01:37 -0800 | |
commit | 1795b6570cae668fa75231a9be8b88cd5fe55543 (patch) | |
tree | 9aec52ae7fec28d458260d1061311b3ff334518c /integration | |
parent | 152e3cb7bf95602e7fd7cf03273ae5e5e288d5cc (diff) | |
download | bun-1795b6570cae668fa75231a9be8b88cd5fe55543.tar.gz bun-1795b6570cae668fa75231a9be8b88cd5fe55543.tar.zst bun-1795b6570cae668fa75231a9be8b88cd5fe55543.zip |
[bun install] Skip saving the lockfile if there are no changes
Diffstat (limited to 'integration')
-rw-r--r-- | integration/apps/bun-install-lockfile-status.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/integration/apps/bun-install-lockfile-status.sh b/integration/apps/bun-install-lockfile-status.sh new file mode 100644 index 000000000..72ba83878 --- /dev/null +++ b/integration/apps/bun-install-lockfile-status.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +set -euo pipefail + +killall -9 $(basename $BUN_BIN) || echo "" + +dir=$(mktemp -d --suffix=bun-lockfile) + +cd $dir + +$BUN_BIN add react + +echo "node_modules" >.gitignore + +git init && git add . && git commit -am "Initial commit" + +$BUN_BIN install + +ORIG_LOCKFILE=$($BUN_BIN bun.lockb) + +[[ -z $(git status --untracked-files=no --porcelain) ]] || { + echo "ERR: Expected empty git status, got '$(git status --untracked-files=no --porcelain)'" + exit 1 +} + +$BUN_BIN add react + +NEW_LOCKFILE=$($BUN_BIN bun.lockb) + +diff <(echo "$ORIG_LOCKFILE") <(echo "$NEW_LOCKFILE") || { + echo "ERR: Expected lockfile to be unchanged, got '$NEW_LOCKFILE'" + exit 1 +} + +[[ -z $(git status --untracked-files=no --porcelain) ]] || { + echo "ERR: Expected empty git status, got '$(git status --untracked-files=no --porcelain)'" + exit 1 +} + +$BUN_BIN remove react +$BUN_BIN add react + +NEW_LOCKFILE=$($BUN_BIN bun.lockb) + +diff <(echo "$ORIG_LOCKFILE") <(echo "$NEW_LOCKFILE") || { + echo "ERR: Expected lockfile to be unchanged, got '$NEW_LOCKFILE'" + exit 1 +} + +echo '{ "dependencies": { "react": "17.0.2", "react-dom": "17.0.2" } }' >package.json + +$BUN_BIN install + +echo "var {version} = JSON.parse(require(\"fs\").readFileSync('./node_modules/react-dom/package.json', 'utf8')); if (version !== '17.0.2') {throw new Error('Unexpected react-dom version');}; " >index.js +$BUN_BIN run ./index.js + +echo "var {version} = JSON.parse(require(\"fs\").readFileSync('./node_modules/react/package.json', 'utf8')); if (version !== '17.0.2') {throw new Error('Unexpected react version');}; " >index.js +$BUN_BIN run ./index.js + +realpath -e node_modules/react-dom +realpath -e node_modules/react |