Skip to content

Commit

Permalink
refactor markdown API
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Jul 30, 2024
1 parent 699b238 commit 0d7401b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 1 addition & 2 deletions lib/reports/markdown-details.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');
const generateMarkdownGrid = require('../utils/markdown.js');
const Util = require('../utils/util.js');

const { getRowData, getFilteredFiles } = require('./console-details.js');
Expand Down Expand Up @@ -103,7 +102,7 @@ const markdownDetailsReport = async (reportData, reportOptions, options) => {
name: 'Uncovered Lines'
}];

const markdownGrid = generateMarkdownGrid({
const markdownGrid = Util.markdown({
options: {
name: reportData.name
},
Expand Down
3 changes: 1 addition & 2 deletions lib/reports/markdown-summary.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');
const generateMarkdownGrid = require('../utils/markdown.js');
const Util = require('../utils/util.js');

const { getSummaryColumns } = require('./console-summary.js');
Expand Down Expand Up @@ -28,7 +27,7 @@ const markdownSummaryReport = async (reportData, reportOptions, options) => {

const columns = getSummaryColumns(color);

const markdownGrid = generateMarkdownGrid({
const markdownGrid = Util.markdown({
options: {
name: reportData.name
},
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const renderHyphen = (column) => {
return ':'.padEnd(width, '-');
};

const generateMarkdownGrid = (data) => {
const markdown = (data) => {

const options = {
name: '',
Expand Down Expand Up @@ -129,4 +129,4 @@ const generateMarkdownGrid = (data) => {
};


module.exports = generateMarkdownGrid;
module.exports = markdown;
6 changes: 5 additions & 1 deletion lib/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ const os = require('os');
const crypto = require('crypto');
const EC = require('eight-colors');
const CG = require('console-grid');
const acornWalk = require('acorn-walk');

const Share = require('../platform/share.js');
const request = require('./request.js');
const version = require('../../package.json').version;
const acornWalk = require('acorn-walk');
const markdown = require('./markdown.js');

const { findUpSync, supportsColor } = require('../packages/monocart-coverage-vendor.js');

// https://github.com/chalk/supports-color
Expand All @@ -29,6 +32,7 @@ const Util = {
root: process.cwd(),

request,
markdown,

relativePath: function(p, root) {
p = `${p}`;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0d7401b

Please sign in to comment.