* chore: update protractor and selenium-webdriver packages
As `karma-jasmine` has a peer dependency on `jasmine-core@2.3`, but `jasmine` and `protractor` are using `jasmine-core@2.4` we need to add `jasmine-core@2.3` explicitly. Previously, the peer dependency was
satisfied by accident because npm deduped the dependency
for `jasmine-core@2.3` as top level dependency.
Note that the shrink-wrap files changes quite a bit because
of the deduping mechanism of npm.
* fix(benchpress): make it work with latest protractor and seleniuv-webdriver
* fix(e2e_tests): make them work with latest protractor
Closes#10503
It is possible for code in `beforeEach` to capture and fork a zone
(for example creating `NgZone` in `beforeEach`). Subsequently the code
in `it` may chose to do `fakeAsync`. The issue is that because the
code in `it` can use `NgZone` from the `beforeEach`. it effectively can
escape the `fakeAsync` zone. A solution is to run all of the test in
`ProxyZone` which allows a test to dynamically replace the rules at any
time. This allows the `beforeEach` to fork a zone, and then `it` to
retroactively became `fakeAsync` zone.
This lets users continue using runtime-sideeffect Decorators if they choose,
only down-leveling the marked ones to Annotations.
Also remove the "skipTemplateCodegen" option, which is no longer needed
since Angular compiles with tsc-wrapped rather than ngc. The former doesn't
include any codegen.
- many entry points were previously missing (e.g. all testing entry points, http, etc)
- upgrade ts-api-guardian to 0.0.3 that adds support for more api surface
- add all info to the spec that was surfaced by ts-api-guardian@0.0.3
Added and used the cors middleware:
- add the module as a dev depedency in the package.json file
- require the module in the jsserve.js file
- add the module in the middleware list
Closes#7273Closes#7274
This tool lets us re-write TypeScript sources before entering the emit pipeline.
For example, we lower Decorators to the tree-shakable Annotation form.
Update the version of zone.js to @0.6.12 that contains the new FakeAsyncTestZoneSpec.
The new fakeAsync zone handles errors better and clearPendingTimers() is no longer required to be called after handling an error and is deprecated.
The fakeAsync test zone will now throw an error if an XHR is attemtped within the test since that cannot be controlled synchronously in the test(Need to be mocked out with a service implementation that doesn't involve XHRs).
This commit also allows fakeAsync to wrap inject to make it consistent with async test zone.
BREAKING CHANGE:
inject can no longer wrap fakeAsync while fakeAsync can wrap inject. So the order in existing tests with inject and fakeAsync has to be switched as follows:
Before:
```
inject([...], fakeAsync((...) => {...}))
```
After:
```
fakeAsync(inject([...], (...) => {...}))
```
Closes#8142
Instead of using injectAsync and returning a promise, use the `async` function
to wrap tests. This will run the test inside a zone which does not complete
the test until all asynchronous tasks have been completed.
`async` may be used with the `inject` function, or separately.
BREAKING CHANGE:
`injectAsync` is now deprecated. Instead, use the `async` function
to wrap any asynchronous tests.
Before:
```
it('should wait for returned promises', injectAsync([FancyService], (service) => {
return service.getAsyncValue().then((value) => { expect(value).toEqual('async value'); });
}));
it('should wait for returned promises', injectAsync([], () => {
return somePromise.then(() => { expect(true).toEqual(true); });
}));
```
After:
```
it('should wait for returned promises', async(inject([FancyService], (service) => {
service.getAsyncValue().then((value) => { expect(value).toEqual('async value'); });
})));
// Note that if there is no injection, we no longer need `inject` OR `injectAsync`.
it('should wait for returned promises', async(() => {
somePromise.then() => { expect(true).toEqual(true); });
}));
```
Closes#7735
To workaround https://github.com/Microsoft/TypeScript/issues/7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
Closes#8003