From 1f7b27202438e19d2b275169dae716bb57aabfe0 Mon Sep 17 00:00:00 2001 From: Michael Barrett Date: Thu, 19 Dec 2024 11:21:54 +0000 Subject: [PATCH] Misc cucumber tweaks no refs Misc cucumber tweaks: - Use `docker compose run` instead of `docker compose up` to get a `TTY` for live updating of progress + colorization of output. Also removes the annoying service name prefix from the output - Use `progress` as the formatter so we can see that things are happening - Use JS based config instead of cmd line args for cucumber.js - Added `failFast` to the config so we can stop on the first failure --- cucumber.js | 20 +++++++++++--------- docker/cucumber-tests | 5 ++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/cucumber.js b/cucumber.js index 958d0cce..630916ae 100644 --- a/cucumber.js +++ b/cucumber.js @@ -1,10 +1,12 @@ -let cmd = `--format-options '{"snippetInterface": "synchronous"}'`; +// https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md -if (process.env.TAGS) { - // @see https://cucumber.io/docs/cucumber/api/?lang=javascript#tags - cmd += ` --tags '${process.env.TAGS}'`; -} - -console.log(cmd); - -export default cmd; +export default { + backtrace: true, + format: ['progress'], + formatOptions: { + snippetInterface: 'synchronous', + }, + failFast: true, + // @see https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags + tags: process.env.TAGS, +}; diff --git a/docker/cucumber-tests b/docker/cucumber-tests index 4ee29a87..705a658d 100755 --- a/docker/cucumber-tests +++ b/docker/cucumber-tests @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Export the input provided to the script as the TAGS environment variable. This +# will then be used by the cucumber-tests container to run only the scenarios +# matching the provided tags expression export TAGS=$1 -docker compose run --rm migrate-testing up && docker compose up cucumber-tests --exit-code-from cucumber-tests +docker compose run --rm migrate-testing up && docker compose run --rm cucumber-tests