Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into command-naming-cons…
Browse files Browse the repository at this point in the history
…istency
  • Loading branch information
0x2b3bfa0 committed Jun 23, 2022
2 parents da8c820 + b45bd61 commit 35d9517
Show file tree
Hide file tree
Showing 6 changed files with 835 additions and 21 deletions.
24 changes: 20 additions & 4 deletions bin/cml/report/create.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const fs = require('fs').promises;
const kebabcaseKeys = require('kebabcase-keys');

const CML = require('../../../src/cml').default;
Expand All @@ -7,10 +6,9 @@ exports.command = 'create <markdown file>';
exports.description = 'Create a report';

exports.handler = async (opts) => {
const path = opts.markdownfile;
const report = await fs.readFile(path, 'utf-8');
opts.markdownFile = opts.markdownfile;
const cml = new CML(opts);
console.log(await cml.commentCreate({ ...opts, report }));
console.log(await cml.commentCreate(opts));
};

exports.builder = (yargs) =>
Expand All @@ -28,6 +26,24 @@ exports.options = kebabcaseKeys({
default: 'HEAD',
description: 'Commit SHA linked to this comment'
},
publish: {
type: 'boolean',
description: 'Upload local files and images linked from the Markdown report'
},
watch: {
type: 'boolean',
description: 'Watch for changes and automatically update the report'
},
triggerFile: {
type: 'string',
description: 'File used to trigger the watcher',
hidden: true
},
native: {
type: 'boolean',
description:
"Uses driver's native capabilities to upload assets instead of CML's storage. Not available on GitHub."
},
update: {
type: 'boolean',
description:
Expand Down
7 changes: 7 additions & 0 deletions bin/cml/report/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ describe('Comment integration tests', () => {
specified commit [boolean]
--commit-sha, --head-sha Commit SHA linked to this comment
[string] [default: \\"HEAD\\"]
--publish Upload local files and images linked from the
Markdown report [boolean]
--watch Watch for changes and automatically update the
report [boolean]
--native Uses driver's native capabilities to upload assets
instead of CML's storage. Not available on GitHub.
[boolean]
--update Update the last CML comment (if any) instead of
creating a new one [boolean]
--rm-watermark Avoid watermark. CML needs a watermark to be able to
Expand Down
Loading

1 comment on commit 35d9517

@github-actions

This comment was marked as outdated.

Please sign in to comment.