How to use the gherkin.fromPaths function in gherkin

To help you get started, we’ve selected a few gherkin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cucumber / cucumber / fake-cucumber / javascript / src / main.ts View on Github external
const fakeTestResultsStream = new FakeTestResultsStream(program.results)
fakeTestResultsStream.on('error', (err: Error) => exit(err))

let formatStream: Transform
switch (program.format) {
  case 'ndjson':
    formatStream = new ProtobufNdjsonStream()
    break
  case 'protobuf':
    formatStream = new ProtobufBinaryStream(messages.Envelope.encodeDelimited)
    break
  default:
    throw new Error(`Unsupported format: '${program.format}'`)
}

gherkin
  .fromPaths(paths, {})
  .pipe(fakeTestResultsStream)
  .pipe(formatStream)
  .pipe(process.stdout)

function exit(err: Error) {
  // tslint:disable-next-line:no-console
  console.error(err)
  process.exit(1)
}
github cucumber / cucumber / fake-cucumber / javascript / src / cli.ts View on Github external
for (const key of Object.keys(supportCode)) {
      // @ts-ignore
      global[key] = supportCode[key]
    }
  }
  await loadSupportCode()
  const cucumberStream = new CucumberStream(
    supportCode.parameterTypes,
    supportCode.stepDefinitions,
    supportCode.beforeHooks,
    supportCode.afterHooks,
    supportCode.newId,
    supportCode.clock
  )
  await pipelinePromise(
    gherkin.fromPaths(paths, options),
    cucumberStream,
    formatStream(program.format),
    process.stdout
  )
}
github cucumber / cucumber-js / src / cli / helpers.js View on Github external
return new Promise((resolve, reject) => {
    const result = []
    const messageStream = Gherkin.fromPaths(featurePaths, {
      defaultDialect: featureDefaultLanguage,
      newId,
    })
    messageStream.on('data', envelope => {
      eventBroadcaster.emit('envelope', envelope)
      if (envelope.pickle) {
        const pickle = envelope.pickle
        const pickleId = pickle.id
        const gherkinDocument =
          eventDataCollector.gherkinDocumentMap[pickle.uri]
        if (pickleFilter.matches({ gherkinDocument, pickle })) {
          eventBroadcaster.emit(
            'envelope',
            messages.Envelope.fromObject({ pickleAccepted: { pickleId } })
          )
          result.push(pickleId)