cenfun / monocart-coverage-reports

A code coverage tool to generate native V8 reports or Istanbul reports.
MIT License
31 stars 5 forks source link

[Question] how to enable the debug info in the console? #32

Closed stevez closed 2 months ago

stevez commented 3 months ago

I want to see the debug info in the console, for example I want to see debug messages in cdp-client.js, I set logging:debug in the playwright.config.js, but only see a couple of other messages.

Please advise

Thanks

cenfun commented 3 months ago

Has 'logging: debug' been set to coverage?

// playwright.config.js
module.exports = {
    reporter: [
        ['list'],
        ['monocart-reporter', {  
            logging: 'debug',
            name: "My Test Report",
            outputFile: './test-results/report.html',
            coverage: {
                logging: 'debug', // for coverage
            }
        }]
    ]
};
stevez commented 3 months ago

No, I don’t know there is anther place to set, I will try and let you knowThanksSent from my iPhoneOn Jun 5, 2024, at 10:36 AM, CenFun @.***> wrote: Has 'logging: debug' been set to coverage? // playwright.config.js module.exports = { reporter: [ ['list'], ['monocart-reporter', {
logging: 'debug', name: "My Test Report", outputFile: './test-results/report.html', coverage: { logging: 'debug', // for coverage } }] ] };

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

stevez commented 3 months ago

I just tried and it is not working either. Could you provide a working example?

Thanks

cenfun commented 3 months ago

Actually, if we want to see the debugging information in console, we must write code to output the information what we want.

for example: console.log("my debug info")

So, what information do you need, and what is this information used for? I'm not sure what I should provide.

stevez commented 3 months ago

I want to debug the cdp-client.js, https://github.com/cenfun/monocart-coverage-reports/blob/main/lib/client/cdp-client.js, for example: https://github.com/cenfun/monocart-coverage-reports/blob/main/lib/client/cdp-client.js#L69 https://github.com/cenfun/monocart-coverage-reports/blob/main/lib/client/cdp-client.js#L84

cenfun commented 3 months ago

OK, I got it, it said the existing code logDebug() in cdp-client.js does NOT work with option logging=debug, let me check.

cenfun commented 3 months ago

I thought the CDPClient could be called in different processes, so the option logging doesn't take effect. This is my idea, it should work:

import { CDPClient, CoverageReport } from 'monocart-coverage-reports';
new CoverageReport({
    logging: 'debug'
});

image

cenfun commented 2 months ago

Please try monocart-coverage-reports@2.8.4, it expose an API for logging

import { Util, CoverageReport } from 'monocart-coverage-reports';
Util.initLoggingLevel('debug');