Skip to content

Typings for cypress-harness doesn't work for internally referenced harnesses from another project #777

Description

@azaeng04

I have a demo app that exports test harnesses from the Angular app and when using the getHarness function I get a type error indicating that the harness is not recognized

Argument of type 'typeof AppHarness' is not assignable to parameter of type 'HarnessQuery<ComponentHarness>'.
  Type 'typeof AppHarness' is not assignable to type 'ComponentHarnessConstructor<ComponentHarness>'.
    Types of parameters 'locatorFactory' and 'locatorFactory' are incompatible.
      Type 'import("/home/azaeng04/projects/test-harnesses/e2e/node_modules/@angular/cdk/testing/index").LocatorFactory' is not assignable to type 'import("/home/azaeng04/projects/test-harnesses/test-angular12/node_modules/@angular/cdk/testing/component-harness").LocatorFactory'.
        Types of property 'locatorFor' are incompatible.
          Type '<T extends (HarnessQuery<any> | string)[]>(...queries: T) => import("/home/azaeng04/projects/test-harnesses/e2e/node_modules/@angular/cdk/testing/index").AsyncFactoryFn<import("/home/azaeng04/projects/test-harnesses/e2e/node_modules/@angular/cdk/testing/index").LocatorFnResult<T>>' is not assignable to type '<T extends (HarnessQuery<any> | string)[]>(...queries: T) => import("/home/azaeng04/projects/test-harnesses/test-angular12/node_modules/@angular/cdk/testing/component-harness").AsyncFactoryFn<import("/home/azaeng04/projects/test-harnesses/test-angular12/node_modules/@angular/cdk/testing/component-harness").LocatorFn...'.
            Types of parameters 'queries' and 'queries' are incompatible.
              Type 'T' is not assignable to type '(string | HarnessQuery<any>)[]'.
                Type '(string | import("/home/azaeng04/projects/test-harnesses/test-angular12/node_modules/@angular/cdk/testing/component-harness").HarnessQuery<any>)[]' is not assignable to type '(string | import("/home/azaeng04/projects/test-harnesses/e2e/node_modules/@angular/cdk/testing/index").HarnessQuery<any>)[]'.
                  Type 'string | import("/home/azaeng04/projects/test-harnesses/test-angular12/node_modules/@angular/cdk/testing/component-harness").HarnessQuery<any>' is not assignable to type 'string | import("/home/azaeng04/projects/test-harnesses/e2e/node_modules/@angular/cdk/testing/index").HarnessQuery<any>'.
                    Type 'ComponentHarnessConstructor<any>' is not assignable to type 'string | HarnessQuery<any>'.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions