-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sh
executable file
·59 lines (50 loc) · 922 Bytes
/
test.sh
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
#!/usr/bin/env bash
set -exo pipefail
_test() {
unset NODE_OPTIONS
"${JEST[@]}" test/config/ESMOnlySoft.spec.ts
! "${JEST[@]}" test/config/ESMOnlyHard.spec.ts >/dev/null 2>/dev/null
env NODE_OPTIONS='--experimental-vm-modules' "${JEST[@]}"
}
_cleanup() {
# undo what yarn@berry did :(
jq 'del(.packageManager)' package.json | sponge package.json
trash node_modules pnpm-lock.yaml package-lock.json yarn.lock .pnp.cjs .yarnrc.yml 2>/dev/null || true
}
describe_pnpm() {
pnpm install
JEST=(jest --verbose)
_test
_cleanup
}
describe_npm() {
npm install
JEST=(jest)
_test
_cleanup
}
describe_yarn() {
yarn install
JEST=(jest)
_test
_cleanup
}
describe_yarnBerry() {
yarn set version berry
yarn install
JEST=(yarn jest)
_test
_cleanup
}
{
_cleanup
if [ "$#" == 0 ]; then
describe_pnpm
describe_npm
describe_yarn
describe_yarnBerry
else
describe_"${1}"
fi
echo "ALL PASS! 🎉"
}