Coder Social home page Coder Social logo

Comments (6)

Hargne avatar Hargne commented on May 26, 2024

Hi,
It has been a bit tricky to reliably get the console.logs from Jest as of lately. Luckily I was able to catch the logs manually and insert them into the report. Please test the latest version: https://github.com/Hargne/jest-html-reporter/releases/tag/2.7.0

It is now possible to gather all console.logs for the test suites below each suite by adding includeConsoleLog to the jest-html-reporter options in the jest config.

It is however (as of now) not possible to get the console.logs to output per test - they will be collected per test suite.

If this solved your issue, please let me know so that we can close this.

from jest-html-reporter.

andreabisello avatar andreabisello commented on May 26, 2024

@Hargne thanks.

i make this test file

describe('temptative', () => {

    test("try foo", async () => {
        console.log("foo foo foo foo foo")
        expect(2).toBe(2)
    })

    test("try bar", async () => {
        console.log("bar bar bar bar bar bar")
        expect(2).toBe(3)
    })

})

i updated the library from 2.6.2
image
to 2.7.0
image
this is my jest config

module.exports = {
    preset: "jest-puppeteer",
    setupFilesAfterEnv: [  // NOT setupFiles
        "./custom-configuration.js",
        "jest-allure/dist/setup"
    ],
    "reporters": [
        "default",
        ["./node_modules/jest-html-reporter", {
            "pageTitle": "Test Report",
            "includeFailureMsg": true,
            "includeConsoleLog": true
        }],
        ["jest-junit", { outputName: "junitreport.xml" }]
    ]
};

and i run jest with this command

image

but there is no console.log in the test-report.html file

image

from jest-html-reporter.

Hargne avatar Hargne commented on May 26, 2024

Interesting. Thanks for the detailed report!
I see that you're using async methods (without await, which should be fine) - can you please test the same thing without async, so that we can rule that out?

from jest-html-reporter.

andreabisello avatar andreabisello commented on May 26, 2024

@Hargne nothing changed.

describe('temptative', () => {

    test("try foo", () => {
        console.log("foo foo foo foo foo")
        expect(2).toBe(2)
    })

    test("try bar", () => {
        console.log("bar bar bar bar bar bar")
        expect(2).toBe(3)
    })

})

from jest-html-reporter.

Hargne avatar Hargne commented on May 26, 2024

Alright!
I recreated your scenario on my machine and I managed to get it working by specifying --verbose=false when running jest. Please test if this works for you as well.

I will make sure to add this to the documentation.

from jest-html-reporter.

andreabisello avatar andreabisello commented on May 26, 2024

@Hargne
as you say.
thanks

from jest-html-reporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.