Skip to content

Commit

Permalink
tools/test: Prepare to add a suite that doesn't run by default
Browse files Browse the repository at this point in the history
Currently, all suites run by default, so the only functional change
is the changed usage-message text.
  • Loading branch information
chrisbobbe authored and gnprice committed Jan 25, 2023
1 parent 3b811d6 commit e785388
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tools/test
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ usage: tools/test [OPTION]... [SUITE]...
Run our tests.
By default, run all suites, but only on files changed in this branch
as found by \`tools/git changed-files \$(tools/git base)\`.
By default, run all suites except any noted under "Suites:" below, but only
on files changed in this branch as found by
\`tools/git changed-files \$(tools/git base)\`.
What tests to run:
--all-files
Expand All @@ -48,8 +49,9 @@ What tests to run:
run Jest tests on only one platform (iOS). This is
usually fine, because the vast majority of our Jest
tests don't depend meaningfully on the platform.
--all In the given suites, run all tests on all files. Same as
--all-files --platform both.
--all In the given suites, run all tests on all files, equivalently
to \`--all-files --platform both\`. If no list of suites was
specified, run all suites.
Extra things to do:
--coverage Collect test-coverage information. Only meaningful
Expand All @@ -68,10 +70,19 @@ EOF
exit 2
}

# The complete list of suites.
all_suites=(native flow lint jest prettier deps tsflower)

opt_coverage=
opt_files=branch
opt_platform=sloppy
opt_fix=

# The suites to run if none are given as arguments. Unless --all is
# specified, this doesn't have to be the complete list; just be sure to
# document in the usage message when a suite gets skipped.
opt_default_suites=(native flow lint jest prettier deps tsflower)

opt_suites=()
while (( $# )); do
case "$1" in
Expand All @@ -86,7 +97,7 @@ while (( $# )); do
esac
shift
;;
--all) opt_files=all; opt_platform=both; shift;;
--all) opt_files=all; opt_platform=both; opt_default_suites=( "${all_suites[@]}" ); shift;;
--fix) opt_fix=1; shift;;
native|flow|lint|jest|prettier|deps|tsflower)
opt_suites+=("$1"); shift;;
Expand All @@ -95,9 +106,7 @@ while (( $# )); do
done

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

files_base_commit=
Expand Down

0 comments on commit e785388

Please sign in to comment.