diff --git a/tools/test b/tools/test index 30709586219..94e31e48bba 100755 --- a/tools/test +++ b/tools/test @@ -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 @@ -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 @@ -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 @@ -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;; @@ -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=