Skip to content

Commit 630c387

Browse files
committed
fix tests
1 parent 07f8214 commit 630c387

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

run-tests.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,43 @@ set -e
33

44
export CI=true
55

6+
echo checking yarn version ...
7+
yarn_version_major=$(yarn --version | cut -d. -f1)
8+
if [[ "$yarn_version_major" != 1 ]]; then
9+
echo 'error: not found yarn version 1. please run: npm i -g yarn@1'
10+
exit 1
11+
fi
12+
echo checking yarn version done
13+
14+
# bug:
15+
# tests expect patch-package in node_modules/patch-package
16+
# but currently is in node_modules/@milahu/patch-package-with-pnpm-support
17+
# workaround:
18+
# temporarily rename to patch-package
19+
echo patching package.json ...
20+
sed -i.bak 's|"name": "@milahu/patch-package-with-pnpm-support"|"name": "patch-package"|' package.json
21+
handle_exit() {
22+
if [ -e package.json.bak ]; then
23+
echo restoring package.json
24+
mv package.json.bak package.json
25+
fi
26+
}
27+
trap handle_exit EXIT INT TERM
28+
echo patching package.json done
29+
diff -u package.json.bak package.json || true
30+
631
yarn clean
732
yarn build
833
version=$(node -e 'console.log(require("./package.json").version)')
934
yarn version --new-version 0.0.0 --no-git-tag-version --no-commit-hooks
1035
yarn pack --filename patch-package.test.$(date +%s).tgz
1136
yarn version --new-version $version --no-git-tag-version --no-commit-hooks
37+
38+
echo restoring package.json ...
39+
mv -v package.json.bak package.json
40+
echo restoring package.json done
41+
trap '' EXIT INT TERM # remove trap handle_exit
42+
1243
yarn jest "$@"
1344

1445
# workaround for https://github.com/yarnpkg/yarn/issues/6685

0 commit comments

Comments
 (0)