'npx @elastic/synthetic journeys' Command to run on specific *journey.ts files

Hello there,

I've been playing with the --pattern, --match and --tags CLI parameters to get just a specific .journey.ts synthetic to execute locally (which will eventually be used in a push command).

In my project/journeys folder I have the following files:


I would like to be able to just run one synthetic selectively (locally), instead of all of them. Eventually, our pipeline job will invoke the 'push' command on either the dev, staging, or prod *.ts files, depending on the pipeline step, which will deploy to our Elastic stacks.

Every permutation/combination of 'npx @elastic/synthetic journeys' I've tried with the --pattern/--match/--tags CLI options results in the following output:

"No tests found! (1234 ms)"

Any guidance you can provide on this would be greatly appreciated. Thanks in advance!


Hey Adam,

Have you tried running with the inline command?

cat path/to/visit.dev.journey.ts | npx @elastic/synthetics --inline

Hi, Kevin. Thanks for getting back to me so quickly!

That didn't occur to me. Ideally, I'd like to be able to run any synthetics with the file name pattern matching .dev. (or .staging., or .prod.), regardless of the number of files.

In my project/journeys folder, say I have the following files:


I'd like to be able to invoke the visit1.dev.journey.ts and visit2.dev.journey.ts selectively for just the .dev. files. We plan on having quite a bit of synthetics and some synthetics will run on some environments, while some will not. We'd like to be able to specify which synthetics will run on which environments this way.

Hence why we were hoping --pattern or --match (or even --tags) could be used to solve this.


I was able to get something working locally with npx @elastic/synthetics --pattern ".dev." ., which is able to detect and run the visit.dev.journey.ts file out of the list of files:


This is definitely a step in the right direction, however, I'd like to only define the file once and maybe utilize the --tags CLI option.

Within the visit.dev.journey.ts Journey file definition, I have the 'tags' option set:

Each of the three files has either the "dev" tag specified, or "staging", or "prod". I'd like to be able to use the --tags in a fashion like:

npx @elastic/synthetics --tags "dev"

Where it will only invoke the visit.dev.journey.ts Journey. That way I don't have to define three files if I want the Journey to run on three environments - I can have one file/definition and just add the environment tags that I need.

When I run npx @elastic/synthetics --tags "dev", it hangs and doesn't complete. Is there an example to use this CLI option that you can provide, or am I using it incorrectly? The documentation for this is very sparse.

Thank you again!


I was able to get something working for this.

I verified all three commands:

npx @elastic/synthetics --pattern ".dev." .
npx @elastic/synthetics --pattern ".stg." .
npx @elastic/synthetics --pattern ".cvg." .

Work on a single file definition:


I was able to weave those three --pattern options into the push commands in our pipeline for our dev, staging and prod environments.

If we want to remove a Synthetic from specific environments, we simply rename the file and remove the appropriate substrings. This seems to fall in line with how Elastic allows the 'deactivation' of a Synthetic (by renaming the 'journey' part of the file name). We have the added benefit of only have one file for the definition of a Synthetic.

If there is a better way to handle this, I'm definitely open to hearing it. :slight_smile: