From 4ee5aa893058bbe9262109b2b4c200d9a1656ac8 Mon Sep 17 00:00:00 2001 From: Maximo Mussini Date: Mon, 24 Apr 2023 16:35:10 -0300 Subject: [PATCH] docs: add section about integration tests in the CI --- docs/src/guide/development.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/src/guide/development.md b/docs/src/guide/development.md index f5130613..8df36ce3 100644 --- a/docs/src/guide/development.md +++ b/docs/src/guide/development.md @@ -173,6 +173,20 @@ It's safe if you are running tests in a CI as it will build in production mode. When running tests locally, you can test the production build by not starting the Vite dev server for tests, or by setting the `CI` environment variable. ::: +## Integration Tests in the CI ✅ + +When running tests in the CI, it's more reliable if assets are available +__before__ tests start to run, as it: + +- Prevents timeouts in Capybara during [autoBuild] +- Prevents race conditions when running tests in parallel (each thread could start a build) + +To achieve that, it's recommended to run `bin/rake assets:precompile`—which should [also run `vite build`][deployment]—in a previous CI step. + +You can verify your setup is working by disabling [autoBuild]. A convenient way to do that is to add `VITE_RUBY_AUTO_BUILD="false"` to the build environment variables. + [avoid rebuilds]: https://github.com/ElMassimo/vite_ruby/tree/main/examples/rails/spec/features/home_spec.rb#15 [publicOutputDir]: /config/#publicoutputdir [port]: /config/#port +[ruby config]: /config/#ruby-configuration-file-💎 +[deployment]: /guide/deployment