samedi 2 septembre 2017

Testcafe not working with knockout

I have added testcafe to my knockoutJS web app via npm install --save-dev testcafe.
I also added "test": "testcafe chrome tests/" to "scripts" in package.json.

I have added a folder called tests and added a file called my-test.ts.

Now, when I execute npm test I am getting a lot of TypeScript compilation errors from node_modules/@types/knockout/index.d.ts.

How can I fix this?


This is my test:

import {Selector} from "testcafe";

fixture("Getting Started")
    .page("http://ift.tt/2engZwU");

test("My first test", async t => {
    // Test code
});

And this is the exact output I am getting:

D:\Projects\ProjectA\src>npm test

> projecta@0.0.1 test D:\Projects\ProjectA\src
> testcafe chrome tests/

ERROR Cannot prepare tests due to an error.

Error: TypeScript compilation failed.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (10, 2): Property 'notifySubscribers' of type '(valueToWrite?: T, event?: string) => void' is not
 assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (20, 2): Property 'equalityComparer' of type '(a: any, b: any) => boolean' is not assignable to s
tring index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (25, 5): Property 'indexOf' of type '(searchElement: T, fromIndex?: number) => number' is not ass
ignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (26, 5): Property 'slice' of type '(start: number, end?: number) => T[]' is not assignable to str
ing index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (27, 5): Property 'splice' of type '{ (start: number): T[]; (start: number, deleteCount: number,
...items: T[]): T[]; }' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (29, 5): Property 'pop' of type '() => T' is not assignable to string index type 'KnockoutBinding
Handler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (30, 5): Property 'push' of type '(...items: T[]) => void' is not assignable to string index type
 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (31, 5): Property 'shift' of type '() => T' is not assignable to string index type 'KnockoutBindi
ngHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (32, 5): Property 'unshift' of type '(...items: T[]) => number' is not assignable to string index
 type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (33, 5): Property 'reverse' of type '() => KnockoutObservableArray<T>' is not assignable to strin
g index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (34, 5): Property 'sort' of type '{ (): KnockoutObservableArray<T>; (compareFunction: (left: T, r
ight: T) => number): KnockoutObser...' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (40, 5): Property 'replace' of type '(oldItem: T, newItem: T) => void' is not assignable to strin
g index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (42, 5): Property 'remove' of type '{ (item: T): T[]; (removeFunction: (item: T) => boolean): T[]
; }' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (44, 5): Property 'removeAll' of type '{ (items: T[]): T[]; (): T[]; }' is not assignable to stri
ng index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (47, 5): Property 'destroy' of type '{ (item: T): void; (destroyFunction: (item: T) => boolean):
void; }' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (49, 5): Property 'destroyAll' of type '{ (items: T[]): void; (): void; }' is not assignable to s
tring index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (64, 5): Property 'subscribe' of type '{ (callback: (newValue: T) => void, target: any, event: "b
eforeChange"): KnockoutSubscription; (c...' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (68, 2): Property 'extend' of type '(requestedExtenders: { [key: string]: any; }) => KnockoutSubs
cribable<T>' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (69, 2): Property 'getSubscriptionsCount' of type '() => number' is not assignable to string inde
x type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (83, 2): Property 'dispose' of type '() => void' is not assignable to string index type 'Knockout
BindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (84, 2): Property 'isActive' of type '() => boolean' is not assignable to string index type 'Knoc
koutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (85, 2): Property 'getDependenciesCount' of type '() => number' is not assignable to string index
 type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (86, 5): Property 'extend' of type '(requestedExtenders: { [key: string]: any; }) => KnockoutComp
uted<T>' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (96, 5): Property 'subscribe' of type '{ (callback: (newValue: KnockoutArrayChange<T>[]) => void,
 target: any, event: "arrayChange"): Kn...' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (101, 5): Property 'extend' of type '(requestedExtenders: { [key: string]: any; }) => KnockoutObs
ervableArray<T>' is not assignable to string index type 'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (114, 2): Property 'peek' of type '() => T' is not assignable to string index type 'KnockoutBindi
ngHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (115, 2): Property 'valueHasMutated' of type '() => void' is not assignable to string index type
'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (116, 2): Property 'valueWillMutate' of type '() => void' is not assignable to string index type
'KnockoutBindingHandler'.
D:/Projects/ProjectA/src/node_modules/@types/knockout/index.d.ts (117, 5): Property 'extend' of type '(requestedExtenders: { [key: string]: any; }) => KnockoutObs
ervable<T>' is not assignable to string index type 'KnockoutBindingHandler'.


Type "testcafe -h" for help.
npm ERR! Test failed.  See above for more details.

D:\Projects\ProjectA\src>

Aucun commentaire:

Enregistrer un commentaire