Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(ngMock): add missing angular. prefix to isDefined calls in $interval #4353

Closed
wants to merge 1 commit into from

Conversation

mjtko
Copy link
Contributor

@mjtko mjtko commented Oct 9, 2013

The newly introduced $interval mock service for ngMock calls isDefined
in the global namespace which fails when used within unit tests.

This change adds the missing angular. prefix to such isDefined calls.

Closes #4334

The newly introduced `$interval` mock service for ngMock calls `isDefined`
in the global namespace which fails when used within unit tests.

This change adds the missing `angular.` prefix to such `isDefined` calls.

Closes angular#4334
@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@mjtko
Copy link
Contributor Author

mjtko commented Oct 9, 2013

I've just signed the CLA. My real name is as it is on my GitHub account, Mark TItorenko.

I'm not certain what I missed about the commit message format. Can somebody point out to me what I've done wrong please?

@petebacondarwin
Copy link
Contributor

So the reason this doesn't fail in our own tests is that isDefined() is defined in routeUtils.js - if you comment out this line: https://github.com/angular/angular.js/blob/master/src/ngRoute/routeUtils.js#L7
and then iit this test: https://github.com/angular/angular.js/blob/master/test/ngMock/angular-mocksSpec.js#L346
then it fails when you run

grunt test:modules

The problem is that https://github.com/angular/angular.js/blob/master/karma-modules.conf.js loads up angularSrcModules which includes all the pre-build module files. See https://github.com/angular/angular.js/blob/master/angularFiles.js#L72

I think instead it should be only loading up the post-build files from the build folder
Or there should be separate karma configs for each module

@petebacondarwin
Copy link
Contributor

We need to refactor the "modules" tests so that they don't leak code into each other. In this case ngRoute is leaking isDefined into ngMock

jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
The newly introduced `$interval` mock service for ngMock calls `isDefined`
in the global namespace which fails when used within unit tests.

This change adds the missing `angular.` prefix to such `isDefined` calls.

Closes angular#4334
Closes angular#4353
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
The newly introduced `$interval` mock service for ngMock calls `isDefined`
in the global namespace which fails when used within unit tests.

This change adds the missing `angular.` prefix to such `isDefined` calls.

Closes angular#4334
Closes angular#4353
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing angular prefix from isDefined calls in ngMock $interval service
3 participants