Skip to content

Update Zone to 0.8.18 and export jasmine/mocha testing scripts #1

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 250 commits into from
Closed

Update Zone to 0.8.18 and export jasmine/mocha testing scripts #1

wants to merge 250 commits into from

Conversation

justindujardin
Copy link

It's hard to include the jasmine/mocha specific zone patches because they depend on ordering. While building a custom {N} entry point, also build single file includes for all the jasmine/mocha zone extensions that are needed to support TestBed.

mhevery and others added 30 commits September 14, 2016 11:01
This means that we will stop polluting the global namespace when
zone.js is included.

Fixes angular#456
…rker

In propertyDescriptorPatch(), when running is Safari browser, patchViaCapturingAllTheEvents() is called
which uses document.addEventListener().
When this code runs in a web worker, there is no document.
Fix by changing document.addEventListener() to self.addEventListener.
 Object.getOwnPropertyNames(proto).indexOf(name) === -1
Some of the setTimeout tests use multiple timers and expect them to execute in a particular order.
Use explicit delay in those places to reflect and guarantee the execution order.

Closes angular#462
`resolvePromise` assumes that if a value is an `instanceof` ZoneAwarePromise
then it has the properties "__zone_symbol__state" and "__zone_symbol__value"
and it _is_ a true ZoneAwarePromise; however, a user can construct a value that
breaks this assumption by inheriting from ZoneAwarePromise without actually
having those properties or being a true ZoneAwarePromise (for example, by
attempting to subclass Promise).

We can fix this by adding checks for "__zone_symbol__state" and
"__zone_symbol__value" to `resolvePromise`.
This will add the badge to show its version on CDNJS and also link to its page on CDNJS!
vikerman and others added 16 commits September 5, 2017 20:13
…ne (angular#893)

Save the URL from xhr.open and log it when throwing an error from FakeAsyncTestZone when the XHR send it attempted. This would make it easier to debug such errors from a fakeAsync test.
…for...of when build zone-node (angular#897)

* feat(compile): fix angular#892, upgrade to typescript 2.3.4(same with angular), add downlevelIteration options when build zone-node

* local test should also use downlevelIteration option
* fix(promise): can set native promise after loading zone.js

* disable SL_IOS9
…context (angular#904)

* fix: EventTarget when using Samusung TV and SourceBuffer

* fix(event): add test cases for EventTarget patch for Samsung tv

* ignore null context test in ie9
The recent change in tsickle to handle @fileoverview comments in a transformer slightly changed our semantics, so the @fileoverview comment was getting lost.  A proper fix in tsickle is forthcoming.
Based on the zone-node entrypoint with the timers module patching
removed. Also add rudimentary support for running NativeScript
tests under node.js (to avoid setting up device emulators).
 - add gulp build tasks for mocha/jasmine testing files for {N}
 - there are three files in nativescript-angular/zone-js/dist now. The dist file (which is updated to 0.8.18) and a file to include when doing angular testing with jasmine as well as one to include for mocha testing.
 - update mocha patch to be tolerant of envs {N} where there is no global window object.
 - run updated tests and disable ones with platform incompatibilities
@justindujardin
Copy link
Author

This is the relevant commit: f7f3183

justindujardin added a commit to justindujardin/nativescript-angular that referenced this pull request Oct 27, 2017
justindujardin added a commit to justindujardin/nativescript-angular that referenced this pull request Oct 28, 2017
justindujardin added a commit to justindujardin/nativescript-angular that referenced this pull request Nov 2, 2017
justindujardin added a commit to justindujardin/nativescript-angular that referenced this pull request Dec 8, 2017
 - update zone build and add jasmine/mocha test scripts, see: NativeScript/zone.js#1
 - refactor testing and zone-js modules to work with each other
 - add generous TestBed setup helpers in testing/src/util.ts
 - add single import test helpers for zone-js patches in zone-js/testing.[framework].ts files
 - update peer deps to reflect updated zone (could peer dep be dropped since prebuilts are exported?)

chore: disable most tests and enable ones that use TestApp one-by-one
 - add test entry point script that inits the test environment for TestBed
 - list view, modal dialog pass
 - detached-loader and platform-filter-component could use feedback. see todos

chore: replace the remaining TestApp usages in test suite

 - xdescribe the failing tests.
 - I think the remaining problems boil down to `dumpView` indicating the ComponentFixture comes back with the root components, and `@ViewChild` not finding DetachedLoader by its class.
 - remove some duplication in testing utilities

chore: cleanup and remove some diff noise from a few tests

chore: remove more test noise

 - are the line-endings different on this file? :(

chore: convince dumpView and TestComponentRenderer to agree on things

 - all the TestBed tests except for the DetachedLoader ones and a single Renderer lifecycle are passing.
 - update NativeScriptRenderer.selectRootElement to find views by ID when given a selector of an id string. TestBed uses this when creating componentRefs to get at the correct views.
 - change NativeScriptTestComponentRenderer to inject only a ProxyViewContainer which mimics what TestApp did.
 - update dumpView to strip off the new "source" data attached to a view.toString() result.

chore: cleanup lint

chore: make nTestBed helpers automatically clean up test components

 - before the components were destroyed by TestBed, but not removed from the rootView.
 - maintain a list of active fixtures for a set of tests, and remove them all when the tests complete.
 - reorder to the testing utils to flow better when reading (start with test init, then before/after then render components)
 - clean up some lint.

chore: fix issue where nTestBedBeforeEach overwrote its own imports

 - Fixes the DetachedLoader tests, and makes them MUCH simpler.
 - When you configure the test bed module, you need to specify a full list of imports, because they completely overwrite the imports array that is used.
 - That's yet another reason to use the provided helper functions, they merge in the common {N} imports for you.
 - ... and some lint cleanup

chore: make renderer lifecyle test more robust

 - the first assertion is that the view after init has been called. rather than assert it, just wait for it using an observable and avoid asserting about timing and implementation specific details of the system. Specifically this removes the assumption that `app.tick()` will advance time and call `ngAfterViewInit` on the component.

chore: cleanup from review

 - re-enable all tests in karma.conf.js
 - remove some diff noise
justindujardin added a commit to justindujardin/nativescript-angular that referenced this pull request Dec 8, 2017
 - update zone build and add jasmine/mocha test scripts, see: NativeScript/zone.js#1
 - refactor testing and zone-js modules to work with each other
 - add generous TestBed setup helpers in testing/src/util.ts
 - add single import test helpers for zone-js patches in zone-js/testing.[framework].ts files
 - update peer deps to reflect updated zone (could peer dep be dropped since prebuilts are exported?)

chore: disable most tests and enable ones that use TestApp one-by-one
 - add test entry point script that inits the test environment for TestBed
 - list view, modal dialog pass
 - detached-loader and platform-filter-component could use feedback. see todos

chore: replace the remaining TestApp usages in test suite

 - xdescribe the failing tests.
 - I think the remaining problems boil down to `dumpView` indicating the ComponentFixture comes back with the root components, and `@ViewChild` not finding DetachedLoader by its class.
 - remove some duplication in testing utilities

chore: cleanup and remove some diff noise from a few tests

chore: remove more test noise

 - are the line-endings different on this file? :(

chore: convince dumpView and TestComponentRenderer to agree on things

 - all the TestBed tests except for the DetachedLoader ones and a single Renderer lifecycle are passing.
 - update NativeScriptRenderer.selectRootElement to find views by ID when given a selector of an id string. TestBed uses this when creating componentRefs to get at the correct views.
 - change NativeScriptTestComponentRenderer to inject only a ProxyViewContainer which mimics what TestApp did.
 - update dumpView to strip off the new "source" data attached to a view.toString() result.

chore: cleanup lint

chore: make nTestBed helpers automatically clean up test components

 - before the components were destroyed by TestBed, but not removed from the rootView.
 - maintain a list of active fixtures for a set of tests, and remove them all when the tests complete.
 - reorder to the testing utils to flow better when reading (start with test init, then before/after then render components)
 - clean up some lint.

chore: fix issue where nTestBedBeforeEach overwrote its own imports

 - Fixes the DetachedLoader tests, and makes them MUCH simpler.
 - When you configure the test bed module, you need to specify a full list of imports, because they completely overwrite the imports array that is used.
 - That's yet another reason to use the provided helper functions, they merge in the common {N} imports for you.
 - ... and some lint cleanup

chore: make renderer lifecyle test more robust

 - the first assertion is that the view after init has been called. rather than assert it, just wait for it using an observable and avoid asserting about timing and implementation specific details of the system. Specifically this removes the assumption that `app.tick()` will advance time and call `ngAfterViewInit` on the component.

chore: cleanup from review

 - re-enable all tests in karma.conf.js
 - remove some diff noise
justindujardin added a commit to justindujardin/nativescript-angular that referenced this pull request Dec 8, 2017
 - update zone build and add jasmine/mocha test scripts, see: NativeScript/zone.js#1
 - refactor testing and zone-js modules to work with each other
 - add generous TestBed setup helpers in testing/src/util.ts
 - add single import test helpers for zone-js patches in zone-js/testing.[framework].ts files
 - update peer deps to reflect updated zone (could peer dep be dropped since prebuilts are exported?)

chore: disable most tests and enable ones that use TestApp one-by-one
 - add test entry point script that inits the test environment for TestBed
 - list view, modal dialog pass
 - detached-loader and platform-filter-component could use feedback. see todos

chore: replace the remaining TestApp usages in test suite

 - xdescribe the failing tests.
 - I think the remaining problems boil down to `dumpView` indicating the ComponentFixture comes back with the root components, and `@ViewChild` not finding DetachedLoader by its class.
 - remove some duplication in testing utilities

chore: cleanup and remove some diff noise from a few tests

chore: remove more test noise

 - are the line-endings different on this file? :(

chore: convince dumpView and TestComponentRenderer to agree on things

 - all the TestBed tests except for the DetachedLoader ones and a single Renderer lifecycle are passing.
 - update NativeScriptRenderer.selectRootElement to find views by ID when given a selector of an id string. TestBed uses this when creating componentRefs to get at the correct views.
 - change NativeScriptTestComponentRenderer to inject only a ProxyViewContainer which mimics what TestApp did.
 - update dumpView to strip off the new "source" data attached to a view.toString() result.

chore: cleanup lint

chore: make nTestBed helpers automatically clean up test components

 - before the components were destroyed by TestBed, but not removed from the rootView.
 - maintain a list of active fixtures for a set of tests, and remove them all when the tests complete.
 - reorder to the testing utils to flow better when reading (start with test init, then before/after then render components)
 - clean up some lint.

chore: fix issue where nTestBedBeforeEach overwrote its own imports

 - Fixes the DetachedLoader tests, and makes them MUCH simpler.
 - When you configure the test bed module, you need to specify a full list of imports, because they completely overwrite the imports array that is used.
 - That's yet another reason to use the provided helper functions, they merge in the common {N} imports for you.
 - ... and some lint cleanup

chore: make renderer lifecyle test more robust

 - the first assertion is that the view after init has been called. rather than assert it, just wait for it using an observable and avoid asserting about timing and implementation specific details of the system. Specifically this removes the assumption that `app.tick()` will advance time and call `ngAfterViewInit` on the component.

chore: cleanup from review

 - re-enable all tests in karma.conf.js
 - remove some diff noise
@hypery2k
Copy link

@mhevery or @alxhub Are we going to see this PR merged?

justindujardin added a commit to justindujardin/nativescript-angular that referenced this pull request Dec 24, 2017
 - update zone build and add jasmine/mocha test scripts, see: NativeScript/zone.js#1
 - refactor testing and zone-js modules to work with each other
 - add generous TestBed setup helpers in testing/src/util.ts
 - add single import test helpers for zone-js patches in zone-js/testing.[framework].ts files
 - update peer deps to reflect updated zone (could peer dep be dropped since prebuilts are exported?)

chore: disable most tests and enable ones that use TestApp one-by-one
 - add test entry point script that inits the test environment for TestBed
 - list view, modal dialog pass
 - detached-loader and platform-filter-component could use feedback. see todos

chore: replace the remaining TestApp usages in test suite

 - xdescribe the failing tests.
 - I think the remaining problems boil down to `dumpView` indicating the ComponentFixture comes back with the root components, and `@ViewChild` not finding DetachedLoader by its class.
 - remove some duplication in testing utilities

chore: cleanup and remove some diff noise from a few tests

chore: remove more test noise

 - are the line-endings different on this file? :(

chore: convince dumpView and TestComponentRenderer to agree on things

 - all the TestBed tests except for the DetachedLoader ones and a single Renderer lifecycle are passing.
 - update NativeScriptRenderer.selectRootElement to find views by ID when given a selector of an id string. TestBed uses this when creating componentRefs to get at the correct views.
 - change NativeScriptTestComponentRenderer to inject only a ProxyViewContainer which mimics what TestApp did.
 - update dumpView to strip off the new "source" data attached to a view.toString() result.

chore: cleanup lint

chore: make nTestBed helpers automatically clean up test components

 - before the components were destroyed by TestBed, but not removed from the rootView.
 - maintain a list of active fixtures for a set of tests, and remove them all when the tests complete.
 - reorder to the testing utils to flow better when reading (start with test init, then before/after then render components)
 - clean up some lint.

chore: fix issue where nTestBedBeforeEach overwrote its own imports

 - Fixes the DetachedLoader tests, and makes them MUCH simpler.
 - When you configure the test bed module, you need to specify a full list of imports, because they completely overwrite the imports array that is used.
 - That's yet another reason to use the provided helper functions, they merge in the common {N} imports for you.
 - ... and some lint cleanup

chore: make renderer lifecyle test more robust

 - the first assertion is that the view after init has been called. rather than assert it, just wait for it using an observable and avoid asserting about timing and implementation specific details of the system. Specifically this removes the assumption that `app.tick()` will advance time and call `ngAfterViewInit` on the component.

chore: cleanup from review

 - re-enable all tests in karma.conf.js
 - remove some diff noise
@vakrilov
Copy link

vakrilov commented Jan 9, 2018

Hey @justindujardin - can you create target the zone-nativescript in this PR and rebase the branch onto it.

@justindujardin
Copy link
Author

@vakrilov it was a pain to rebase the update of Zone.js so I just opened a new PR that only applies the exported testing changes. If you need the updated version of Zone, let me know: #2

vakrilov pushed a commit to NativeScript/nativescript-angular that referenced this pull request May 16, 2018
* feat(testing): support TestBed and export jasmine/mocha zone scripts

 - update zone build and add jasmine/mocha test scripts, see: NativeScript/zone.js#1
 - refactor testing and zone-js modules to work with each other
 - add generous TestBed setup helpers in testing/src/util.ts
 - add single import test helpers for zone-js patches in zone-js/testing.[framework].ts files
 - update peer deps to reflect updated zone (could peer dep be dropped since prebuilts are exported?)

chore: disable most tests and enable ones that use TestApp one-by-one
 - add test entry point script that inits the test environment for TestBed
 - list view, modal dialog pass
 - detached-loader and platform-filter-component could use feedback. see todos

chore: replace the remaining TestApp usages in test suite

 - xdescribe the failing tests.
 - I think the remaining problems boil down to `dumpView` indicating the ComponentFixture comes back with the root components, and `@ViewChild` not finding DetachedLoader by its class.
 - remove some duplication in testing utilities

chore: cleanup and remove some diff noise from a few tests

chore: remove more test noise

 - are the line-endings different on this file? :(

chore: convince dumpView and TestComponentRenderer to agree on things

 - all the TestBed tests except for the DetachedLoader ones and a single Renderer lifecycle are passing.
 - update NativeScriptRenderer.selectRootElement to find views by ID when given a selector of an id string. TestBed uses this when creating componentRefs to get at the correct views.
 - change NativeScriptTestComponentRenderer to inject only a ProxyViewContainer which mimics what TestApp did.
 - update dumpView to strip off the new "source" data attached to a view.toString() result.

chore: cleanup lint

chore: make nTestBed helpers automatically clean up test components

 - before the components were destroyed by TestBed, but not removed from the rootView.
 - maintain a list of active fixtures for a set of tests, and remove them all when the tests complete.
 - reorder to the testing utils to flow better when reading (start with test init, then before/after then render components)
 - clean up some lint.

chore: fix issue where nTestBedBeforeEach overwrote its own imports

 - Fixes the DetachedLoader tests, and makes them MUCH simpler.
 - When you configure the test bed module, you need to specify a full list of imports, because they completely overwrite the imports array that is used.
 - That's yet another reason to use the provided helper functions, they merge in the common {N} imports for you.
 - ... and some lint cleanup

chore: make renderer lifecyle test more robust

 - the first assertion is that the view after init has been called. rather than assert it, just wait for it using an observable and avoid asserting about timing and implementation specific details of the system. Specifically this removes the assumption that `app.tick()` will advance time and call `ngAfterViewInit` on the component.

chore: cleanup from review

 - re-enable all tests in karma.conf.js
 - remove some diff noise

* chore: update for @angular ~5.1.0

 - incorporate changes from zone to include @panayot.cankov's drainMicroTaskQueue update
 - update zone.js deps to reference "*" for version. Ideally it would be removed, but I believe @angular has a peer dependency on it so satisfy it with a star. This is because zone.js files are prebuilt specifically for {N} so there is no need to bring them in as a dep.

* chore: do not upgrade zone.js version

 - the TestBed changes do not depend on the upgrade (after review), and given that there are strange errors, prefer to reduce the number of changes that are not strictly required.

* chore(tests): Fix Renderer Tests

* fix: rxjs6 imports

* refactor: Remove snippets tests

* chore(build): Allow CI testing

* fix(compat-error): Resolve RxJS issue

Adding rxjs-compat

* feat(zone): Update zonejs to 0.8.26

* chore(tests): Unit tests made green again

* chore(test): Provide NSLocationStrategy for modal tests

* fix(zone): Fix zone js patching Promise prop descriptr and breaking android snapshot
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.