build: upgrade jasmine (and related typings) to latest version (#19904)

With these changes, the types are a little stricter now and also not
compatible with Protractor's jasmine-like syntax. So, we have to also
use `@types/jasminewd2` for e2e tests (but not for non-e2e tests).

I also had to "augment" `@types/jasminewd2`, because the latest
typings from [DefinitelyTyped][1] do not reflect the fact that the
`jasminewd2` version (v2.1.0) currently used by Protractor supports
passing a `done` callback to a spec.

[1]: 566e039485/types/jasminewd2/index.d.ts (L9-L15)

Fixes #23952
Closes #24733

PR Close #19904
This commit is contained in:
George Kalpakas
2017-10-24 14:54:08 +03:00
committed by Miško Hevery
parent 1e74ea9e60
commit 00c110b055
59 changed files with 332 additions and 283 deletions

View File

@ -1203,8 +1203,8 @@ describe('di', () => {
describe('@Attribute', () => {
it('should inject attribute', () => {
let exist: string|undefined = 'wrong';
let nonExist: string|undefined = 'wrong';
let exist = 'wrong' as string | undefined;
let nonExist = 'wrong' as string | undefined;
const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
@ -1221,8 +1221,8 @@ describe('di', () => {
// https://stackblitz.com/edit/angular-8ytqkp?file=src%2Fapp%2Fapp.component.ts
it('should not inject attributes representing bindings and outputs', () => {
let exist: string|undefined = 'wrong';
let nonExist: string|undefined = 'wrong';
let exist = 'wrong' as string | undefined;
let nonExist = 'wrong' as string | undefined;
const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
@ -1238,8 +1238,8 @@ describe('di', () => {
});
it('should not accidentally inject attributes representing bindings and outputs', () => {
let exist: string|undefined = 'wrong';
let nonExist: string|undefined = 'wrong';
let exist = 'wrong' as string | undefined;
let nonExist = 'wrong' as string | undefined;
const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
@ -1415,7 +1415,7 @@ describe('di', () => {
// so that we have smaller HelloWorld.
(parent.tNode as{parent: any}).parent = undefined;
const injector = getOrCreateNodeInjector();
const injector: any = getOrCreateNodeInjector(); // TODO: Review use of `any` here (#19904)
expect(injector).not.toBe(null);
} finally {
leaveView(oldView);

View File

@ -259,7 +259,7 @@ describe('NgOnChangesFeature', () => {
it('correctly computes firstChange', () => {
class MyDirective implements OnChanges {
public log: Array<string|SimpleChange> = [];
public log: Array<string|SimpleChange|undefined> = [];
public valA: string = 'initValue';
// TODO(issue/24571): remove '!'.
public valB !: string;

View File

@ -112,7 +112,7 @@ describe('elementProperty', () => {
class OtherDir {
// TODO(issue/24571): remove '!'.
id !: boolean;
id !: number;
clickStream = new EventEmitter();
static ngDirectiveDef = defineDirective({
@ -138,7 +138,7 @@ describe('elementProperty', () => {
class IdDir {
// TODO(issue/24571): remove '!'.
idNumber !: number;
idNumber !: string;
static ngDirectiveDef = defineDirective({
type: IdDir,
@ -347,15 +347,14 @@ describe('elementProperty', () => {
}
}
expect(renderToHtml(Template, {condition: true, id1: 'one', id2: 'two', id3: 'three'}, deps))
expect(renderToHtml(Template, {condition: true, id1: 'one', id2: 'two', id3: 3}, deps))
.toEqual(`<button iddir="">Click me</button><button id="two">Click me too</button>`);
expect(idDir !.idNumber).toEqual('one');
expect(
renderToHtml(Template, {condition: false, id1: 'four', id2: 'two', id3: 'three'}, deps))
expect(renderToHtml(Template, {condition: false, id1: 'four', id2: 'two', id3: 3}, deps))
.toEqual(`<button iddir="">Click me</button><button otherdir="">Click me too</button>`);
expect(idDir !.idNumber).toEqual('four');
expect(otherDir !.id).toEqual('three');
expect(otherDir !.id).toEqual(3);
});
});

View File

@ -293,11 +293,11 @@ describe('array literals', () => {
const e0_ff =
(v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any,
v8: any) => ['start', v0, v1, v2, v3, v4, v5, v6, v7, v8, 'end'];
const e0_ff_1 = (v: any) => { return {name: v}; };
const e0_ff_1 = (v: any) => `modified_${v}`;
renderToHtml(Template, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], directives);
/**
* <my-comp [names]="['start', v0, v1, v2, v3, {name: v4}, v5, v6, v7, v8, 'end']">
* <my-comp [names]="['start', v0, v1, v2, v3, `modified_${v4}`, v5, v6, v7, v8, 'end']">
* </my-comp>
*/
function Template(rf: RenderFlags, c: any) {
@ -315,17 +315,17 @@ describe('array literals', () => {
}
expect(myComp !.names).toEqual([
'start', 'a', 'b', 'c', 'd', {name: 'e'}, 'f', 'g', 'h', 'i', 'end'
'start', 'a', 'b', 'c', 'd', 'modified_e', 'f', 'g', 'h', 'i', 'end'
]);
renderToHtml(Template, ['a1', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], directives);
expect(myComp !.names).toEqual([
'start', 'a1', 'b', 'c', 'd', {name: 'e'}, 'f', 'g', 'h', 'i', 'end'
'start', 'a1', 'b', 'c', 'd', 'modified_e', 'f', 'g', 'h', 'i', 'end'
]);
renderToHtml(Template, ['a1', 'b', 'c', 'd', 'e5', 'f', 'g', 'h', 'i'], directives);
expect(myComp !.names).toEqual([
'start', 'a1', 'b', 'c', 'd', {name: 'e5'}, 'f', 'g', 'h', 'i', 'end'
'start', 'a1', 'b', 'c', 'd', 'modified_e5', 'f', 'g', 'h', 'i', 'end'
]);
});