Skip to content

Configuration

Available options

Since 3.9.0 vitest-cucumber allows you to set a global configuration.

Default vitest-cucumber configurations uses:

  • en for the language
  • ignore for the excluded tags

You can use this function in your Vitest setup file. See:

import { setVitestCucumberConfiguration } from '@amiceli/vitest-cucumber'
setVitestCucumberConfiguration({
language: 'fr', excludeTags: ['beta']
})
// or just excludeTags
setVitestCucumberConfiguration({
excludeTags: ['beta']
})
// or just language
setVitestCucumberConfiguration({
language: 'it'
})

Now all Scenario, Background and Rule with beta or ignore tags will be excluded.

onStepError

Since 3.11.0 version, vitest-cucumber provides onStepError configuration option.

onStepError is passed as callback to onTestFailed when step failed.

Example:

setVitestCucumberConfiguration({
onStepError ({ error, ctx, step}) {
// error : first error caught by onTestFailed
// ctx : TaskContext
// step : current failed step
console.error(step.details)
screen.logTestingPlayground()
}
})

tags

Example configuration :

setVitestCucumberConfiguration({
excludeTags: ['beta'] // Array<string | string[]>
includedTags: [] // Array<string | string[]>
})

includedTags will set which scenario / rule / background to run.

excludeTags will ignore matching scenario / rule / background using describe.skip.

By default excludeTags contains ignore tags.

You can use nesting tags filtering.

env variables

Since v4.2.0 vitest-cucumber handles env variable for excluded and included tags :

  • VITEST_INCLUDE_TAGS : will set includedTags in global options
  • VITEST_EXCLUDE_TAGS : will set excludedTags in global options