Configuration
Available options
Section titled “Available options”Since 3.9.0 vitest-cucumber allows you to set a global configuration.
Default vitest-cucumber configurations uses:
enfor the languageignorefor 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
Section titled “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()
}
})
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
Section titled “env variables”Since v4.2.0 vitest-cucumber handles env variable for excluded and included tags :
VITEST_INCLUDE_TAGS: will setincludedTagsin global optionsVITEST_EXCLUDE_TAGS: will setexcludedTagsin global options