From fa1f2ee06c603fc94d8787c25973eed50bbf420b Mon Sep 17 00:00:00 2001 From: Ross Brandes Date: Tue, 24 Sep 2024 21:59:37 -0400 Subject: [PATCH] Simplify test scripts --- script/test | 2 +- script/test_example_app | 36 +++++++++++++----------------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/script/test b/script/test index a5abf23..ec1db5d 100755 --- a/script/test +++ b/script/test @@ -9,7 +9,7 @@ bundle echo "---> Running tests" bundle exec rake -./script/test_example_app $@ +BUNDLE_GEMFILE="${1-Gemfile}" ./script/test_example_app bundle exec rake test diff --git a/script/test_example_app b/script/test_example_app index d84cd34..eebbf21 100755 --- a/script/test_example_app +++ b/script/test_example_app @@ -2,27 +2,17 @@ set -e -gemfile="${1-Gemfile}" - -run_example_tests() { - bundle - yarn install - - # test a normal test run - bundle exec rake db:test:prepare - NODE_OPTIONS=--openssl-legacy-provider RAILS_ENV=test bundle exec rake assets:precompile - bundle exec rake cypress:run - - # test that passing options works (by printing help) - if ! bundle exec rake cypress:run CYPRESS_RAILS_CYPRESS_OPTS="-h" | grep -q "Usage: cypress run \[options\]"; then - echo "Failed to pass options to cypress run" - exit 1 - fi -} - - cd example - -echo "---> Running example tests with ${gemfile}" -BUNDLE_GEMFILE=$gemfile run_example_tests - +bundle +yarn install + +# test a normal test run +bundle exec rake db:test:prepare +NODE_OPTIONS=--openssl-legacy-provider RAILS_ENV=test bundle exec rake assets:precompile +bundle exec rake cypress:run + +# test that passing options works (by printing help) +if ! bundle exec rake cypress:run CYPRESS_RAILS_CYPRESS_OPTS="-h" | grep -q "Usage: cypress run \[options\]"; then + echo "Failed to pass options to cypress run" + exit 1 +fi