This precompiler removes all or particular type of semantic comments from the feature file.
'use strict';
const compiler = require('gherking');
const { default: RemoveComments, CommentType } = require('gpc-remove-comments');
let ast = await compiler.load('./features/src/login.feature');
ast = compiler.process(
ast,
new RemoveComments({
keep: CommentType.STEP | CommentType.PRECEDING
})
);
await compiler.save('./features/dist/login.feature', ast, {
lineBreak: '\r\n'
});
'use strict';
import {load, process, save} from "gherking";
import RemoveComments, { CommentType } from "gpc-remove-comments";
let ast = await load("./features/src/login.feature");
ast = process(
ast,
new RemoveComments({
keep: CommentType.STEP | CommentType.PRECEDING
})
);
await save('./features/dist/login.feature', ast, {
lineBreak: '\r\n'
});
By default, the precompiler removes all comments. But to keep certain type of comments, the keep
configuration options
and the CommentType flags can be used.
CommentType.ALL
in keep
CommentType.NONE
in keep
(this is the default)CommentType.STEP | CommentType.TAG
.gherking.json
When the configuration is set in the .gherking.json
, the names of the CommentType
can be used and passed as a string array, e.g.
{
"compilers": [
{
"path": "gpc-remove-comments",
"configuration": {
"keep": ["STEP", "TAG"]
}
}
]
}
This package uses debug for logging, use gpc:remove-comments
:
DEBUG=gpc:remove-comments* gherking ...
For detailed documentation see the TypeDocs documentation.
Generated using TypeDoc