Skip to content

fix(jasmine-frame): Switch to addMatchingHelperFiles#10725

Closed
benmvp wants to merge 1 commit intowebdriverio:mainfrom
benmvp:fix-jasmine-runner
Closed

fix(jasmine-frame): Switch to addMatchingHelperFiles#10725
benmvp wants to merge 1 commit intowebdriverio:mainfrom
benmvp:fix-jasmine-runner

Conversation

@benmvp
Copy link

@benmvp benmvp commented Jul 13, 2023

Proposed changes

jasmine removed addHelperFiles in its v4 release, but @wdio/jasmine-framework is still calling it. @wdio/jasmine-framework is using v5 of jasmine now. This method was deprecated in favor of addMatchingSpecFiles.

I have some projects that are failing with an error stack pointing to this line. I have others that pass, however. I'm not sure why some projects work and others don't, but when I manually changed the method in node_modules, everything succeeded.

An example error:

console.log
    [0-0] 2023-07-13T21:10:26.737Z WARN @wdio/jasmine-framework: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialised.
    [0-0] `browser` object has only `capabilities` and some flags like `isMobile`.
    [0-0] Helper files that use other `browser` commands have to be moved to `before` hook.
    [0-0] Spec file(s): file:///tmp/tmp-5251AfIFKtpqHtwm/test.e2e.ts
    [0-0]  Error:  TypeError: this._jrunner.addHelperFiles is not a function
    [0-0]     at JasmineAdapter._loadFiles (file:///tmp/tmp-5251AfIFKtpqHtwm/auth-i18n/node_modules/@wdio/jasmine-framework/build/index.js:170:31)
    [0-0]     at JasmineAdapter.init (file:///tmp/tmp-5251AfIFKtpqHtwm/auth-i18n/node_modules/@wdio/jasmine-framework/build/index.js:155:20)
    [0-0]     at Object.adapterFactory.init (file:///tmp/tmp-5251AfIFKtpqHtwm/auth-i18n/node_modules/@wdio/jasmine-framework/build/index.js:350:36)
    [0-0]     at Runner.#initFramework (file:///tmp/tmp-5251AfIFKtpqHtwm/auth-i18n/node_modules/@wdio/runner/build/index.js:168:30)
    [0-0]     at async Runner.run (file:///tmp/tmp-5251AfIFKtpqHtwm/auth-i18n/node_modules/@wdio/runner/build/index.js:72:27)
    [0-0] TypeError: elem[prop] is not a function
    [0-0]     at file:///tmp/tmp-5251AfIFKtpqHtwm/auth-i18n/node_modules/@wdio/utils/build/shim.js:188:38

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

I don't know how to add a test for this. I'm assuming there weren't any before.

Reviewers: @webdriverio/project-committers

@linux-foundation-easycla
Copy link

CLA Not Signed

@christian-bromann
Copy link
Member

@benmvp thanks for the PR, mind signing the CLA?

@christian-bromann
Copy link
Member

implemented by #10864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants