karma-runner / karma-runner/karma-jasmine
Opening Context.html window raises an error for parentWindow.karma object "Cannot read property 'info' of undefined"
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 537
- Forks
- 162
- PR merge metrics
- No merged PRs in 30d
Description
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:
- Generate a new project from scratch by angular cli: ng n <project_name>.
- Run unit tests: ng test.
- open http://localhost:9876/context.html while executing tests locally
- expect result: context page shows a tests result without errors, actual result: context page shows errors.
- The issue is similar to https://github.com/karma-runner/karma-jasmine/issues/147
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in context.js at ContextKarma.getDirectCallParentKarmaMethod and reproduce the problem by opening context.html at localhost:9876 while ng test is running. Trace how the parent window is obtained when parentWindow.karma is unavailable. Done means the context page displays the test result without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100