Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 22
node-version: 24
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.1.0
- added `showLogs` flag to enable/disable `text/x.cucumber.log+plain` logs

# 0.18.1
- fixed home navigation

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default {
],
formatOptions: {
htmlConfig: {
showLogs: true, // enable/disable text/x.cucumber.log+plain
metadata: {
'OS': 'macos',
'OS Version': '13.1'
Expand Down
20 changes: 14 additions & 6 deletions formatter/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class HTMLStream {
write(data) {
const dataBuffer = Buffer.from(data);
const buffer = Buffer.concat([dataBuffer, this.ender]);
write(this.fd, buffer, 0, buffer.length, this.position, () => {});
write(this.fd, buffer, 0, buffer.length, this.position, () => {
});
this.position += dataBuffer.length;
}

Expand All @@ -22,10 +23,12 @@ class HTMLStream {
class HTMLFormatter extends Formatter {

hooks = {};
options = {};

constructor(options) {
super(options);
const metadata = JSON.stringify(options.parsedArgvOptions.htmlConfig?.metadata ?? {});
this.options.showLogs = options.parsedArgvOptions.htmlConfig.showLogs ?? true;
const htmlTemplate = readFileSync(path.resolve(__dirname, './index.html'), 'utf-8')
.replace('METADATA', metadata);
const [left, right] = htmlTemplate.split('SOURCE_DATA');
Expand Down Expand Up @@ -67,11 +70,16 @@ class HTMLFormatter extends Formatter {
duration: result.duration.seconds * 1_000_000_000 + result.duration.nanos,
error_message: result.message
};
step.embeddings = testCase.stepAttachments[step.id]?.map(attachment => ({
...attachment,
data: attachment.body,
mime_type: attachment.mediaType
}));
step.embeddings = testCase.stepAttachments[step.id]
?.filter(attachment => {
const isAttachment = attachment.mediaType !== 'text/x.cucumber.log+plain';
return this.options.showLogs || isAttachment
})
.map(attachment => ({
...attachment,
data: attachment.body,
mime_type: attachment.mediaType
}));
}
const scenario = {
feature,
Expand Down
Loading
Loading