Skip to content

Commit e785388

Browse files
chrisbobbegnprice
authored andcommitted
tools/test: Prepare to add a suite that doesn't run by default
Currently, all suites run by default, so the only functional change is the changed usage-message text.
1 parent 3b811d6 commit e785388

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

tools/test

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ usage: tools/test [OPTION]... [SUITE]...
2828
2929
Run our tests.
3030
31-
By default, run all suites, but only on files changed in this branch
32-
as found by \`tools/git changed-files \$(tools/git base)\`.
31+
By default, run all suites except any noted under "Suites:" below, but only
32+
on files changed in this branch as found by
33+
\`tools/git changed-files \$(tools/git base)\`.
3334
3435
What tests to run:
3536
--all-files
@@ -48,8 +49,9 @@ What tests to run:
4849
run Jest tests on only one platform (iOS). This is
4950
usually fine, because the vast majority of our Jest
5051
tests don't depend meaningfully on the platform.
51-
--all In the given suites, run all tests on all files. Same as
52-
--all-files --platform both.
52+
--all In the given suites, run all tests on all files, equivalently
53+
to \`--all-files --platform both\`. If no list of suites was
54+
specified, run all suites.
5355
5456
Extra things to do:
5557
--coverage Collect test-coverage information. Only meaningful
@@ -68,10 +70,19 @@ EOF
6870
exit 2
6971
}
7072

73+
# The complete list of suites.
74+
all_suites=(native flow lint jest prettier deps tsflower)
75+
7176
opt_coverage=
7277
opt_files=branch
7378
opt_platform=sloppy
7479
opt_fix=
80+
81+
# The suites to run if none are given as arguments. Unless --all is
82+
# specified, this doesn't have to be the complete list; just be sure to
83+
# document in the usage message when a suite gets skipped.
84+
opt_default_suites=(native flow lint jest prettier deps tsflower)
85+
7586
opt_suites=()
7687
while (( $# )); do
7788
case "$1" in
@@ -86,7 +97,7 @@ while (( $# )); do
8697
esac
8798
shift
8899
;;
89-
--all) opt_files=all; opt_platform=both; shift;;
100+
--all) opt_files=all; opt_platform=both; opt_default_suites=( "${all_suites[@]}" ); shift;;
90101
--fix) opt_fix=1; shift;;
91102
native|flow|lint|jest|prettier|deps|tsflower)
92103
opt_suites+=("$1"); shift;;
@@ -95,9 +106,7 @@ while (( $# )); do
95106
done
96107

97108
if [ -z "$opt_suites" ]; then
98-
# This default doesn't have to be the complete list; just be sure to
99-
# document in the usage message any suites that it skips.
100-
opt_suites=(native flow lint jest prettier deps tsflower)
109+
opt_suites=( "${opt_default_suites[@]}" )
101110
fi
102111

103112
files_base_commit=

0 commit comments

Comments
 (0)