解析feature和csv文件插件

Dennis Zhang - Nov 4 - - Dev Community
npm i gherkin-parse csv-parse
Enter fullscreen mode Exit fullscreen mode
const parse = require("gherkin-parse")
const fs = require("fs")

const jsonObject = parse.convertFeatureFileToJson(featurePath)

const featureString = parse.convertJSONToFeatureFile(jsonObject)// 没有包含comment

const comment =jsonObject.comments.map(item=>item.text).join("\n")

// update feature file
fs.writeFileSync(featurePath,`${featureString}\n\n\n${comment}` )

Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player