13a15479dSJames Ide#!/usr/bin/env bash 23a15479dSJames Ide 33a15479dSJames Ideset -eo pipefail 43a15479dSJames Ide 53a15479dSJames Idescript_dir="$(dirname "$0")" 63a15479dSJames Ide 73a15479dSJames Ideargs=("$@") 8ec4c554eSEvan Bacon 9ec4c554eSEvan Bacon# If the command is used like `yarn test plugin`, set the --rootDir option to the `plugin` directory 10ec4c554eSEvan Baconif [ "$1" == "plugin" ]; then 11ec4c554eSEvan Bacon args=() 12ec4c554eSEvan Bacon args+=("--rootDir") 13ec4c554eSEvan Bacon args+=("plugin") 14ec4c554eSEvan Bacon 15*a9e9eb76SJames Ide if [[ -f plugin/jest.config.js ]]; then 16ec4c554eSEvan Bacon args+=("--config") 17ec4c554eSEvan Bacon args+=("plugin/jest.config.js") 18ec4c554eSEvan Bacon fi 19ec4c554eSEvan Bacon 20ec4c554eSEvan Bacon # Push the rest of the arguments minus the `plugin` arg 21ec4c554eSEvan Bacon args+=("${@:2}") 22ec4c554eSEvan Baconfi 23ec4c554eSEvan Bacon 243a15479dSJames Ideif [[ -t 1 && (-z "$CI" && -z "$EXPO_NONINTERACTIVE") ]]; then 253a15479dSJames Ide args+=("--watch") 263a15479dSJames Idefi 273a15479dSJames Ide 283a15479dSJames Ide"$script_dir/expo-module-jest" "${args[@]}" 29