testimio / root-cause

🔍 [DEPRECATED] Root Cause is a tool for troubleshooting Puppeteer and Playwright tests. 🔎
GNU Affero General Public License v3.0
266 stars 17 forks source link

Config file does not work #102

Closed MrZordex closed 3 years ago

MrZordex commented 3 years ago

Hi, I've created a config file root-cause-main\integration-examples\another-jest-and-puppeteer\.root-causerc.json with the following code inside (taken from the example):

{
    "features": {
        "screenshots": {
            "format": "png",
            "fullPage": true
        },
        "networkLogs": true,
        "jestAssertions": true,
        "console": false
    }
}

But the saved screenshots are still .jpg Is there something I'm missing? Thanks.

omril1 commented 3 years ago

It might indicate that the default configuration was used instead of the file. Is the root-causerc.json in your current directory when running the command, I mean did you 'cd' into root-cause-main\integration-examples\another-jest-and-puppeteer\ before running the command?

MrZordex commented 3 years ago

@omril1 Yes, I run npm test from another-jest-and-puppeteer directory.

MrZordex commented 3 years ago

I've created a root-cause.config.js fine in the root directory with the content:

module.exports = {
    features: {
        screenshots: {
            format: "png",
            fullPage: true
        },
        networkLogs: true,
        jestAssertions: true,
        console: true
    }
}

It works fine now, but I get the following message:

 console.warn
    `require.cache` modification is not permitted

      at Object.notPermittedMethod (node_modules/jest-runtime/build/index.js:1512:44)
      at importFresh (node_modules/cosmiconfig/node_modules/import-fresh/index.js:28:23)
      at loader (node_modules/cosmiconfig/src/loaders.ts:15:18)
      at Explorer.loadFileContent (node_modules/cosmiconfig/src/Explorer.ts:81:32)
      at Explorer.createCosmiconfigResult (node_modules/cosmiconfig/src/Explorer.ts:89:36)
      at Explorer.loadSearchPlace (node_modules/cosmiconfig/src/Explorer.ts:65:31)
      at Explorer.searchDirectory (node_modules/cosmiconfig/src/Explorer.ts:47:27)

Should I just ignore it or am I doing something wrong?

omril1 commented 3 years ago

Possibly a jest bug (https://github.com/facebook/jest/issues/9916)? Seems a bit weird since it says released in 25.5.4 and the example is using 26. I don't think we are doing any changes to require.cache, and the stack trace does point to this place.