Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
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
)
}
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)