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

chore(*): Upgrade to Jasmine 2.4 #14226

Closed
wants to merge 1 commit into from
Closed

Conversation

lgalfaso
Copy link
Contributor

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Chore

What is the current behavior? (You can also link to an open issue here)
All tests run with Jasmine 1.3

What is the new behavior (if this is a feature change)?
All tests run with Jasmine 2.4

Does this PR introduce a breaking change?
No

Please check if the PR fulfills these requirements

Other information:

Highlights:
in Jasmine, this is no longer jasmine.Spec. Removed the tests that check this.
New mechanism to run async tests as Jasmine 2 removed runs, waits and waitsFor
The functions iit, ddescribe and tthey were renamed fit, fdescribe and fthey
as the originals came from Karma, Karma no longer bundles Jasmine and the new function
name comes from Jasmine
7e91645 was partially reverted. Kept the test, remove the code changes

@lgalfaso
Copy link
Contributor Author

This PR is big and given that it changes many files, can get easily rotten, so it would be ideal if this can be reviewed fast.

@lgalfaso
Copy link
Contributor Author

There is a pending task to upgrade grunt-ddescribe-iit to support for fthey

@lgalfaso
Copy link
Contributor Author

I do not have access to IE9, can someone check why there is an error when running tests:modules ?

@Narretz
Copy link
Contributor

Narretz commented Mar 14, 2016

@lgalfaso The complete log shows an error for FIrefox in tests:modules:

Firefox 43.0.0 (Linux 0.0.0) ERROR
  Error: [ng:btstrpd] App Already Bootstrapped with this Element '<div ng-app="">'
  http://errors.angularjs.org/1.5.1-build.20899+sha.0082806/ng/btstrpd?p0=%26lt%3Bdiv%20ng-app%3D%22%22%26gt%3B
  at /home/travis/build/angular/angular.js/build/angular.js:68
.................
Firefox 43.0.0 (Linux 0.0.0): Executed 17 of 713 ERROR (0.126 secs / 0.027 secs)

IE 9 is fine:

IE 9.0.0 (Windows 7 0.0.0): Executed 713 of 713 SUCCESS (2.888 secs / 2.348 secs)

@Narretz
Copy link
Contributor

Narretz commented Mar 14, 2016

Why was lgalfaso@7e91645 reverted? Because we don't support these browsers?

@lgalfaso
Copy link
Contributor Author

Why was lgalfaso/angular.js@7e91645 reverted? Because we don't support these browsers?

Jasmine 2.4 toEqual checks that actual and expected are of the same type. 7e91645 changes the type of what is thrown.

@Narretz
Copy link
Contributor

Narretz commented Mar 14, 2016

Ok, thanks. Can you add that explanation to the commit message?

['$filterProvider', 'register', createArgumentsOf(['f', 'ff'])],
['$compileProvider', 'directive', createArgumentsOf(['d', 'dd'])],
['$compileProvider', 'component', createArgumentsOf(['c', 'cc'])],
['$controllerProvider', 'register', createArgumentsOf(['ctrl', 'ccc'])]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to just use jasmine.objectContaining for these tests?

@petebacondarwin
Copy link
Contributor

@lgalfaso can you confirm that after the change to the angular mock module tests still work on PhantomJS and Safari 7? This is the only part that affects people outside of this project so it would be good to make sure we are not breaking anything.

Highlights:
New mechanism to run async tests as Jasmine 2 removed `runs`, `waits` and `waitsFor`
The functions `iit`, `ddescribe` and `tthey` were renamed `fit`, `fdescribe` and `fthey`
  as the originals came from Karma, Karma no longer bundles Jasmine and the new function
  name comes from Jasmine
@lgalfaso
Copy link
Contributor Author

Reverted the changes on angular.mocks.js, made the changes on loaderSpec.js, fixed the issue with Firefox and now the test are back to green.

PTAL

@@ -9,7 +9,7 @@ describe('private mocks', function() {
spyOn(window, 'it');

they('should do stuff with $prop', ['a', 'b', 'c']);
expect(window.it.calls.length).toEqual(3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these could be converted instead to .calls.count()).toEqual(... This would make it similar to what is was before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think the new way is better and the way that is present in Jasmine documentation

@Narretz
Copy link
Contributor

Narretz commented Mar 15, 2016

Since we now officially move to jasmine 2.4, I think we should also change the docs to recommend jasmine 2.4 instead of 1.3, espepcially here: https://github.com/angular/angular.js/blob/a4e60cb6970d8b6fa9e0af4b9f881ee3ba7fdc99/docs/content/guide/unit-testing.ngdoc and https://github.com/angular/angular.js/blob/a4e60cb6970d8b6fa9e0af4b9f881ee3ba7fdc99/docs/content/guide/e2e-testing.ngdoc The unit tests in the guide don't actually run, so they have to be checked for correctness with jasmine 2.4. @lgalfaso do you want to make these changes? I can also do it if you want.

@lgalfaso
Copy link
Contributor Author

Updated the docs, did not run the tests in the guide, but in theory it
should be possible for users to use the version from Jasmine that they like
the most.

On Tue, Mar 15, 2016 at 1:43 PM, Martin Staffa [email protected]
wrote:

Since we now move to jasmine 2.4, I think we should also change the docs
to recommend jasmine 2.4 instead of 1.3, espepcially here:
https://github.com/angular/angular.js/blob/a4e60cb6970d8b6fa9e0af4b9f881ee3ba7fdc99/docs/content/guide/unit-testing.ngdoc
and
https://github.com/angular/angular.js/blob/a4e60cb6970d8b6fa9e0af4b9f881ee3ba7fdc99/docs/content/guide/e2e-testing.ngdoc
The unit tests in the guide don't actually run, so they have to be checked
for correctness with jasmine 2.4. @lgalfaso https://github.com/lgalfaso
do you want to make these changes? I can also do it if you want.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#14226 (comment)

petebacondarwin pushed a commit that referenced this pull request Mar 16, 2016
Highlights:
New mechanism to run async tests as Jasmine 2 removed `runs`, `waits` and `waitsFor`
The functions `iit`, `ddescribe` and `tthey` were renamed `fit`, `fdescribe` and
`fthey` as the originals came from Karma, Karma no longer bundles Jasmine and the
new function name comes from Jasmine.

Closes #14226
petebacondarwin pushed a commit that referenced this pull request Mar 16, 2016
Highlights:
New mechanism to run async tests as Jasmine 2 removed `runs`, `waits` and `waitsFor`
The functions `iit`, `ddescribe` and `tthey` were renamed `fit`, `fdescribe` and
`fthey` as the originals came from Karma, Karma no longer bundles Jasmine and the
new function name comes from Jasmine.

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

Successfully merging this pull request may close these issues.

4 participants