Closed rameshkumar91 closed 1 year ago
@rameshkumar91 thanks for raising an issue. Can you please provide a reproducible example? I just set up a new wdio project and the JSON report was created successfully. Please make sure you have the latest version v5.0.3
of the reporter installed.
I found the issue with my setup.. I have two configs - one which I maintain in the local repo and the other as a package which has all the common configs (including the reporter) and is merged with the local config at runtime. The reporter package is installed as part of the common configuration file.
I tried installing the reporter package to the local repo and it worked. But I am not sure why the prev setup did not work though as the reporter package is still part of the configuration
Thanks for confirming. Will close then.
Environment (please complete the following information):
Config of webdriver.io and the reporter An example of how you configured the reporter in your webdriver.io config //imports import { generate } from "multiple-cucumber-html-reporter"; import * as wdioParallel from "wdio-cucumber-parallel-execution"; import _yargs from "yargs"; import { hideBin } from "yargs/helpers"; const cliArgs = _yargs(hideBin(process.argv)).argv; let tags; try { tags = cliArgs.cucumberOpts.tagExpression; } catch { tags = ""; } import { removeSync } from "fs-extra/esm"; import ConfFunction from "./ConfFunctions.config.js";
export const CommonConfig = { hostname: ConfFunction.hostName(cliArgs.browser), specs: [ 'sourceSpecDirectory/*.feature' ],
// ============ // Capabilities // ============
capabilities: [ ConfFunction.generateCapability(cliArgs.browser, tags, cliArgs.feature), ],
// =================== // Test Configurations // =================== logLevel: 'trace', bail: 0, baseUrl: ConfFunction.baseURL(cliArgs.environment), services: ConfFunction.serviceName(cliArgs.browser), framework: "cucumber", reporters: ["spec", "cucumberjs-json"], onPrepare: function (config, capabilities) { }, beforeSession: function (config, capabilities, specs, cid) { }, before: function (capabilities, specs, browser) { }, afterStep: async function (test, scenario, { error, duration, passed }) { if (error) { CucumberJsJsonReporter.attach(await browser.takeScreenshot(), "image/png"); } }, afterScenario: async function (world, result) { } await browser.execute("window.sessionStorage.clear();"); await browser.execute("window.localStorage.clear();"); await browser.deleteCookies(); }, onComplete: function () { generate({ jsonDir: ".tmp/json/", reportPath: "./CucumberReport/", disableHooks: true, displayDuration: true, durationInMS: false, }); }, };
Describe the bug ERROR @wdio/local-runner: Failed launching test session: Error: Couldn't find plugin "cucumberjs-json" reporter, neither as wdio scoped package "@wdio/cucumberjs-json-reporter" nor as community package "wdio-cucumberjs-json-reporter". Please make sure you have it installed! [0-0] at initialisePlugin (file:///C://node_modules/@wdio/utils/build/initialisePlugin.js:36:11) [0-0] at async BaseReporter._loadReporter (file:///C://node_modules/@wdio/runner/build/reporter.js:178:30) [0-0] at async Promise.all (index 1) [0-0] at async BaseReporter.initReporters (file:///C://node_modules/@wdio/runner/build/reporter.js:23:27) [0-0] at async Runner.run (file:///C://node_modules/@wdio/runner/build/index.js:68:9) 2023-05-03T21:18:24.030Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
To Reproduce Steps to reproduce the behavior:
Expected behavior Test run and report generated
Snapshots If applicable, add snapshots to help explain your problem.
Additional context Add any other context about the problem here.