Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Opening Context.html window raises an error for parentWindow.karma object "Cannot read property 'info' of undefined" #331

Open
ghost opened this issue Feb 17, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 17, 2023

if I open CONTEXT page with jasmine test result while tests are running locally, It will always end up with errors:
TypeError: Cannot read properties of undefined (reading 'info')

the issue is happening inside of context.js script due to karma is undefined for parentWindow object

ContextKarma.getDirectCallParentKarmaMethod = function (parentWindow) {
  return function directCallParentKarmaMethod (method, args) {
    // If the method doesn't exist, then error out
    if (!parentWindow.karma[method]) {
      parentWindow.karma.error('Expected Karma method "' + method + '" to exist but it doesn\'t')
      return
    }

    // Otherwise, run our method
    parentWindow.karma[method].apply(parentWindow.karma, args)
  }
}

Steps to reproduce:

  1. Generate a new project from scratch by angular cli: ng n <project_name>.
  2. Run unit tests: ng test.
  3. open http://localhost:9876/context.html while executing tests locally
  4. expect result: context page shows a tests result without errors, actual result: context page shows errors.
  5. The issue is similar to Opening DEBUG window fires an error for parentWindow.karma object "Cannot read property 'error' of undefined" #147
@HolgerJeromin
Copy link

Riding a dead horse but perhaps this is helping someone:
I had a similar error with an pending('waiting for adjustment') inside an describe.
Moving inside it solved the problem here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant