webdriverio/webdriverio

[🐛 Bug]: webdriverio and mocha fw execution returns: no test runtime is found. Please check test framework configuration

Open

#14.425 aberto em 22 de abr. de 2025

Ver no GitHub
 (13 comments) (0 reactions) (0 assignees)JavaScript (1.793 forks)batch import
Bug 🐛help wanted

Métricas do repositório

Stars
 (6.029 stars)
Métricas de merge de PR
 (Mesclagem média 15d 15h) (48 fundiu PRs em 30d)

Description

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.12.6

Node.js Version

11.2.0

Mode

WDIO Testrunner

Which capabilities are you using?

import { Options } from '@wdio/types';
import { junitXmlConfig, allureHtmlConfig, jsonConfig } from "@config/utils/reporters.ts";
import * as hooks from "@config/utils/hooks.ts";
import { getCapabilities } from "@config/capabilities/browserLocalCapabilities.ts";
import { getBrowserstackCapabilities } from "@config/capabilities/browserstackCapabilities.ts";
import { BrowserstackConfig } from "@config/config-interfaces/browserstackInterface.ts";
import { browserstackEnvConfig } from "@config/browserstack/browserstackConfig.ts";
import { globalFwVars } from "@config/utils/globalVars.ts";
import { configureProxy, loadEnv } from "./config/utils/utils.ts";

await loadEnv();
await configureProxy();

const browserstackConfig: BrowserstackConfig = await browserstackEnvConfig();
const { browserName, bstack, osBstack, osVersion, key_bstack, user_bstack } = browserstackConfig;

export const config: WebdriverIO.Config = {
  suites: {
    all: ["./tests/**/*.spec.ts"],
  },
  runner: "local",
  ...(bstack === "true" && {
    user: user_bstack,
    key: key_bstack,
    hostname: globalFwVars.browserstack.hostname,
    waitforTimeout: 60000,
    connectionRetryTimeout: 6000000,
    connectionRetryCount: 3,
    logLevel: globalFwVars.logs.logLevel as Options.WebDriverLogTypes,
    services: [
      [
        "browserstack",
        {
          browserstackLocal: true,
          opts: {
            forceLocal: true,
            verbose: true,
            localIdentifier: process.env.BSTACK_LOCAL_IDENTIFIER,
          },
        },
      ],
    ],
  }),

  specs: ["./tests/**/*.spec.ts"],
  exclude: [],
  maxInstances: 1,
  specFileRetries: 0,
  specFileRetriesDeferred: false,
  specFileRetriesDelay: 0,
  capabilities: [
    ...(bstack === "true"
      ? getBrowserstackCapabilities(browserName, osBstack, osVersion)
      : getCapabilities(browserName)),
  ],
  logLevel: globalFwVars.logs.logLevel as Options.WebDriverLogTypes,
  bail: 0,
  waitforTimeout: 60000,
  connectionRetryTimeout: 600000,
  connectionRetryCount: 3,

  reporters: [
    "spec", 
    ["junit", junitXmlConfig], 
    ["allure", allureHtmlConfig], 
    ["json", jsonConfig]
  ],

  framework: "mocha",
  mochaOpts: {
    ui: "bdd",
    timeout: 600000,
    retries: 0,
  },

  onPrepare: hooks.onPrepare,
  before: hooks.before,
  onComplete: hooks.onComplete,
  afterTest: hooks.afterTest,
};

// Ignore certificate errors
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

What happened?

Description When running tests with WebdriverIO using Mocha as the framework and Chrome in normal or headless mode, I’m seeing the following output:

[0-5] no test runtime is found. Please check test framework configuration [0-5] no test runtime is found. Please check test framework configuration [0-5] PASSED in chrome - file:///C:/workspace/example-web/tests/tests-front-example/simple-two-test.spec.ts Despite the error messages, the test is marked as PASSED, which is confusing.

Browser: Chrome with visor and chrome headless.

Test framework: Mocha

Config: import { Options } from '@wdio/types'; import { junitXmlConfig, allureHtmlConfig, jsonConfig } from "@config/utils/reporters.ts"; import * as hooks from "@config/utils/hooks.ts"; import { getCapabilities } from "@config/capabilities/browserLocalCapabilities.ts"; import { getBrowserstackCapabilities } from "@config/capabilities/browserstackCapabilities.ts"; import { BrowserstackConfig } from "@config/config-interfaces/browserstackInterface.ts"; import { browserstackEnvConfig } from "@config/browserstack/browserstackConfig.ts"; import { globalFwVars } from "@config/utils/globalVars.ts"; import { configureProxy, loadEnv } from "./config/utils/utils.ts";

await loadEnv(); await configureProxy();

const browserstackConfig: BrowserstackConfig = await browserstackEnvConfig(); const { browserName, bstack, osBstack, osVersion, key_bstack, user_bstack } = browserstackConfig;

export const config: WebdriverIO.Config = { suites: { all: ["./tests/**/*.spec.ts"], }, runner: "local", ...(bstack === "true" && { user: user_bstack, key: key_bstack, hostname: globalFwVars.browserstack.hostname, waitforTimeout: 60000, connectionRetryTimeout: 6000000, connectionRetryCount: 3, logLevel: globalFwVars.logs.logLevel as Options.WebDriverLogTypes, services: [ [ "browserstack", { browserstackLocal: true, opts: { forceLocal: true, verbose: true, localIdentifier: process.env.BSTACK_LOCAL_IDENTIFIER, }, }, ], ], }),

specs: ["./tests/**/*.spec.ts"], exclude: [], maxInstances: 1, specFileRetries: 0, specFileRetriesDeferred: false, specFileRetriesDelay: 0, capabilities: [ ...(bstack === "true" ? getBrowserstackCapabilities(browserName, osBstack, osVersion) : getCapabilities(browserName)), ], logLevel: globalFwVars.logs.logLevel as Options.WebDriverLogTypes, bail: 0, waitforTimeout: 60000, connectionRetryTimeout: 600000, connectionRetryCount: 3,

reporters: [ "spec", ["junit", junitXmlConfig], ["allure", allureHtmlConfig], ["json", jsonConfig] ],

framework: "mocha", mochaOpts: { ui: "bdd", timeout: 600000, retries: 0, },

onPrepare: hooks.onPrepare, before: hooks.before, onComplete: hooks.onComplete, afterTest: hooks.afterTest, };

// Ignore certificate errors process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

package.json dependencies installed: "devDependencies": { "@types/mocha": "^10.0.10", "@types/node-fetch": "^2.6.12", "@types/oracledb": "^6.5.1", "@types/pg": "^8.11.10", "@wdio/allure-reporter": "^9.12.6", "@wdio/browserstack-service": "^9.12.7", "@wdio/cli": "^9.12.7", "@wdio/json-reporter": "^9.12.6", "@wdio/junit-reporter": "^9.12.6", "@wdio/local-runner": "^9.12.7", "@wdio/mocha-framework": "^9.12.6", "@wdio/spec-reporter": "^9.12.6", "@wdio/types": "^9.12.6", "allure-commandline": "^2.29.0", "browserstack-local": "^1.5.5", "chai": "^5.2.0", "cross-env": "^7.0.3", "glob": "^11.0.1", "junit-merge": "^2.0.0", "junit-report-merger": "^7.0.1", "mocha": "^11.1.0", "mochawesome-merge": "^4.3.0", "ts-node": "^10.9.2", "typedoc": "^0.27.6", "typescript": "^5.7.3", "undici": "^7.3.0", "webdriverio": "^9.12.7" },

Chrome options: const baseChromeOptions: ChromeOptions = { args: [ '--disable-geolocation', '--no-default-browser-check', '--disable-default-apps', '--disable-search-engine-choice-screen', '--start-maximized', '--ignore-certificate-errors', '--ignore-ssl-errors', '--disable-popup-blocking', '--disable-blink-features=AutomationControlled', '--disable-password-manager-reauthentication', '--disable-features=PasswordManagerExtensions', '--enable-unsafe-swiftshader', ], prefs: commonPrefs, };

case 'chrome': default: return [ { maxInstances: 1, browserName: 'chrome', 'wdio:enforceWebDriverClassic': true, 'goog:chromeOptions': baseChromeOptions, acceptInsecureCerts: true, }, ];

Steps to Reproduce

  1. Use Chrome
  2. Run a specs with npx wdio run ./wdio.conf.ts
  3. Observe the console logs

Actual Behavior Test logs indicate that no runtime was found, but tests still pass.

What is your expected behavior?

Expected Behavior Tests should run without logging misleading [no test runtime is found] errors.

How to reproduce the bug.

Pre-conditions:

  1. Use the configuration wdio.conf attach in this issue
  2. Use the same framework mocha
  3. Use the same package.json
  4. Use the same webdriverIO version

Relevant log output

[0-2] no test runtime is found. Please check test framework configuration
[0-2] no test runtime is found. Please check test framework configuration
[0-2] PASSED in chrome - file:///workspace/example-web/tests/tests-front-example/go-to-login.spec.ts
[0-3] Log level set to: error
[0-3] ✅ Environments variables loaded correctly from: C:\workspace\example-web\config\environments\.env.pre
[0-3] RUNNING in chrome - file:///C:/workspace/example-web/tests/tests-front-example/handle-multiple-tabs.spec.ts

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Guia do colaborador