Skip to content

[🐛 Bug]: Sauce Service beforeTest throws when fullName is undefined #14999

@localClient

Description

@localClient

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.21.0

Node.js Version

  • Node: 22.x (also seen in GH Actions Ubuntu 22.04 runner)

Mode

WDIO Testrunner

Which capabilities are you using?

{
  browserName: 'chrome'
  browserVersion: 'latest'
  platformName: 'Windows 10'
  'wdio:maxInstances': 10
  'wdio:enforceWebDriverClassic': true
}

What happened?

SauceService.beforeTest attempts to set _suiteTitle using:

if (this._suiteTitle === 'Jasmine__TopLevel__Suite') {
  this._suiteTitle = test.fullName.slice(
    0,
    test.fullName.indexOf(test.description || '') - 1
  )
}

On Jasmine runs the framework hook receives a test object without fullName (and sometimes without description). The call to slice throws, the error is logged by @wdio/utils (shim), and execution continues. The job still passes, but the logs are flooded with the error on every beforeTest.

Example log line (repeats for every spec):

ERROR @wdio/utils:shim: TypeError: Cannot read properties of undefined (reading 'slice')
    at SauceService.beforeTest (.../node_modules/@wdio/sauce-service/build/index.js:257:40)

What is your expected behavior?

  • Sauce service should handle missing fullName / description gracefully (either skip deriving the name or use a fallback) and avoid throwing.

Impact

  • CI logs are flooded with hundreds of identical TypeErrors on passing suites, obscuring real issues.
  • The service still works (job names / annotations may be missing), but logging noise is significant.

How to reproduce the bug.

Minimal reproduction steps

  1. npm init wdio@latest (or use an existing v9.21.0 project) with framework: jasmine and enable @wdio/sauce-service.
  2. Add a trivial Jasmine spec:
    describe('sample', () => {
      it('runs', () => { expect(true).toBeTrue(); });
    });
  3. Run via Sauce (e.g., wdio wdio.sauce.conf.ts -f jasmine --spec ./path/to/spec.ts) with valid Sauce creds.
  4. Observe worker logs: every spec logs TypeError: Cannot read properties of undefined (reading 'slice') from @wdio/utils:shim pointing to SauceService.beforeTest.

Relevant log output

Sanitized log below

2026-01-09T15:52:56.0782062Z [0-8] RUNNING in chrome(latest) on Windows 10 - file:///path/to/spec.ts
2026-01-09T15:52:56.2600204Z [0-7] RUNNING in chrome(latest) on Windows 10 - file:///path/to/spec.ts
...
2026-01-09T15:53:02.5111831Z [0-7] 2026-01-09T15:53:02.509Z ERROR @wdio/utils:shim: TypeError: Cannot read properties of undefined (reading 'slice')
[0-7]     at SauceService.beforeTest (file:///path/to/project/node_modules/@wdio/sauce-service/build/index.js:257:40)
[0-7]     at <anonymous> (/path/to/project/node_modules/@wdio/utils/build/index.js:945:22)
[0-7] Error in "BeforeTest Hook"
[0-7]     at new Promise (<anonymous>)
Cannot read properties of undefined (reading 'slice')
[0-7]     at <anonymous> (/path/to/project/node_modules/@wdio/utils/build/index.js:942:45)
[0-7]     at Array.map (<anonymous>)
[0-7]     at executeHooksWithArgs (/path/to/project/node_modules/@wdio/utils/build/index.js:942:31)
[0-7]     at UserContext.testFrameworkFnWrapper (/path/to/project/node_modules/@wdio/utils/build/index.js:1171:45)
[0-7]     at UserContext.testFnWrapper (/path/to/project/node_modules/@wdio/utils/build/index.js:1163:33)
[0-7]     at UserContext.wrappedFn (/path/to/project/node_modules/@wdio/utils/build/index.js:1250:26)
[0-7]     at QueueRunner.attempt (/path/to/project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:8545:40)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions