Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Jan 11, 2024
1 parent ab3634a commit 64baba6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
31 changes: 25 additions & 6 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
import { TestInfo } from "@playwright/test"

import type { CoverageReportOptions } from "monocart-coverage-reports";
export * from 'monocart-coverage-reports';
import type { TestInfo } from "@playwright/test"
import type { Reporter } from '@playwright/test/reporter';

import type {
CoverageReportOptions,
CoverageResults,
AddedResults
} from "monocart-coverage-reports";

export type {
CoverageReportOptions,
ReportDescription,
V8CoverageEntry,
Watermarks,
CoverageResults,
CoverageSummary,
MetricsSummary,
CoverageFile,
CoverageRange,
AddedResults
} from 'monocart-coverage-reports';

export default class MonocartReporter implements Reporter { }

export type MonocartReporterOptions = {
// the report name
Expand Down Expand Up @@ -107,13 +126,13 @@ export function attachAuditReport(
export function addCoverageReport(
coverageData: any[] | any,
testInfo: TestInfo
): Promise<any | void>;
): Promise<AddedResults>;

export function attachCoverageReport(
coverageData: any[] | any,
testInfo: TestInfo,
options?: CoverageReportOptions
): Promise<any>;
): Promise<CoverageResults>;


/**
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Util = require('./utils/util.js');

// custom reporter
// https://playwright.dev/docs/test-reporters#custom-reporters
class Reporter {
class MonocartReporter {

static Util = Util;

Expand Down Expand Up @@ -211,4 +211,4 @@ class Reporter {

}

module.exports = Reporter;
module.exports = MonocartReporter;
8 changes: 4 additions & 4 deletions lib/plugins/coverage/coverage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs');
const path = require('path');
const CoverageReport = require('monocart-coverage-reports');
const MCR = require('monocart-coverage-reports');
const Util = require('../../utils/util.js');

const attachCoverageReport = async (data, testInfo, options = {}) => {
Expand Down Expand Up @@ -28,7 +28,7 @@ const attachCoverageReport = async (data, testInfo, options = {}) => {
... options
};

const coverageReport = new CoverageReport(coverageOptions);
const coverageReport = MCR(coverageOptions);
await coverageReport.add(data);
const coverageResults = await coverageReport.generate();

Expand Down Expand Up @@ -76,7 +76,7 @@ const addCoverageReport = async (data, testInfo) => {
const reporterOptions = Util.resolveReporterOptions(testInfo);
const coverageOptions = await getGlobalCoverageOptions(reporterOptions);

const coverageReport = new CoverageReport(coverageOptions);
const coverageReport = MCR(coverageOptions);
const results = await coverageReport.add(data);

return results;
Expand All @@ -86,7 +86,7 @@ const generateGlobalCoverageReport = async (reporterOptions) => {

const coverageOptions = await getGlobalCoverageOptions(reporterOptions);

const coverageReport = new CoverageReport(coverageOptions);
const coverageReport = MCR(coverageOptions);

// check if has cache
if (!coverageReport.hasCache()) {
Expand Down

0 comments on commit 64baba6

Please sign in to comment.