Gherkin 流线
这个模块包含使用有流的Gherkin库的公用事业.
安装
gherkin-streams 有3个同伴依赖关系: @cucumber/gherkin, (中文(简体) ), @cucumber/messages
财务报告和审定财务报表 @cucumber/message-streams。 。 。 .
你必须要有 @cucumber/gherkin 财务报告和审定财务报表@cucumber/message-streams 在你的属下,
@cucumber/messages 自动安装 @cucumber/gherkin。 。 。 .
npm install @cucumber/gherkin-streams @cucumber/gherkin @cucumber/message-streams
使用量
import { GherkinStreams } from '@cucumber/gherkin-streams'
const options = {
includeSource: true,
includeGherkinDocument: true,
includePickles: true,
}
const stream = GherkinStreams.fromPaths(['features/hello.feature'])
// Pipe the stream to another stream that can read messages.
stream.pipe(...)
缩短URI relativeTo
包含 relativeTo 选项,以避免排放更长或绝对的铀RI,而使其仅相对于当前工作目录(或任何对您的使用有道理的东西):
import { GherkinStreams } from '@cucumber/gherkin-streams'
// imagine `discoverPaths()` is a function that returns absolute paths
const paths = discoverPaths();
const options = {
includeSource: true,
includeGherkinDocument: true,
includePickles: true,
relativeTo: process.cwd()
}
const stream = GherkinStreams.fromPaths(paths)
// Pipe the stream to another stream that can read messages.
stream.pipe(...)