webdriverio / webdriverio

Next-gen browser and mobile automation test framework for Node.js
http://webdriver.io
MIT License
8.86k stars 2.46k forks source link

[🐛 Bug]: Error: There isn't any active suite! #13013

Open jcrosetto opened 2 weeks ago

jcrosetto commented 2 weeks ago

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.37.0

Node.js Version

18.20.3

Mode

Standalone Mode

Which capabilities are you using?

No response

What happened?

After upgrading to webdriverio version 8.37.0 some test suite runs are failing with Error: There isn't any active suite!

In the allure report the test is showing as passed, so this error must be happening aftewards. I did a little digging and it looks like it may be failing because _endTest in reporter.js is being called for one of the hook states that gets pushed on the _state stack.

This does not occur in version 8.36.1.

What is your expected behavior?

Tests pass without failures.

How to reproduce the bug.

Minimal example (corresponding gist) that recreates the issue:

  1. Create a custom service that extends the browser object in the before method.
  2. Create a test suite that calls the function added to the browser object within the before hook followed by a call to browser.url (there must be both). I used the mocha test runner but I'm not sure if this matters.
  3. Add a nested describe block that a contains a single test.
  4. Run the test and observe the error in the output.

Relevant log output

Terminal output:

Error: There isn't any active suite!
    at AllureReporter._endSuite (./node_modules/@wdio/allure-reporter/build/reporter.js:80:19)
    at AllureReporter.onSuiteEnd (./node_modules/@wdio/allure-reporter/build/reporter.js:307:14)
    at AllureReporter.<anonymous> (./node_modules/@wdio/reporter/build/index.js:165:18)
    at AllureReporter.emit (node:events:517:28)
    at AllureReporter.emit (node:domain:489:12)
    at ./node_modules/@wdio/runner/build/reporter.js:47:56
    at Array.forEach (<anonymous>)
    at BaseReporter.emit (./node_modules/@wdio/runner/build/reporter.js:47:25)
    at MochaAdapter.emit (./node_modules/@wdio/mocha-framework/build/index.js:162:24)
    at Runner.emit (node:events:529:35)
    at Runner.emit (node:domain:489:12)
    at ./node_modules/@wdio/mocha-framework/node_modules/mocha/lib/runner.js:896:12
    at next (./node_modules/@wdio/mocha-framework/node_modules/mocha/lib/runner.js:474:14)
    at Immediate.<anonymous> (./node_modules/@wdio/mocha-framework/node_modules/mocha/lib/runner.js:559:5)
    at processImmediate (node:internal/timers:476:21)

Code of Conduct

Is there an existing issue for this?

wdio-bot commented 2 weeks ago

Thanks for reporting!

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

mhmmdaminn commented 1 week ago

haloo i got a same error like this :

2024-06-14T09:20:51.207Z ERROR @wdio/utils:shim: Error: There isn't any active test! [0-0] at AllureReporter.attachFile (file:///Users/61525/example/testing-mobile-2/testing-mobile/node_modules/@wdio/allure-reporter/build/reporter.js:58:19) [0-0] at AllureReporter.attachScreenshot (file:///Users/61525/example/testing-mobile-2/testing-mobile/node_modules/@wdio/allure-reporter/build/reporter.js:71:14) [0-0] at AllureReporter.onAfterCommand (file:///Users/61525/example/testing-mobile-2/testing-mobile/node_modules/@wdio/allure-reporter/build/reporter.js:363:18) [0-0] at AllureReporter.emit (node:events:532:35) [0-0] at AllureReporter.emit (node:domain:488:12) [0-0] at file:///Users/61525/example/testing-mobile-2/testing-mobile/node_modules/@wdio/runner/build/reporter.js:47:56 [0-0] at Array.forEach () [0-0] at BaseReporter.emit (file:///Users/61525/example/testing-mobile-2/testing-mobile/node_modules/@wdio/runner/build/reporter.js:47:25) [0-0] at EventEmitter. (file:///Users/61525/example/testing-mobile-2/testing-mobile/node_modules/@wdio/runner/build/index.js:207:58) [0-0] at EventEmitter.emit (node:events:520:28)

this log appear when i'm running my script. before feature file is called.

I hope anyone know how to fix this problem.