Skip to content
This repository has been archived by the owner on Feb 16, 2019. It is now read-only.

How to run Typescript tests #29

Closed
hkirk opened this issue May 22, 2017 · 6 comments
Closed

How to run Typescript tests #29

hkirk opened this issue May 22, 2017 · 6 comments

Comments

@hkirk
Copy link

hkirk commented May 22, 2017

Not sure if this is the appropriate way to ask questions, but I can't find a way to run the typescript tests in test/assets/* could you explain how to run these tests?

@hkirk
Copy link
Author

hkirk commented May 22, 2017

Seeing this when trying to run sbt test

embo-2:web henrik$ sbt test
[warn] Executing in batch mode.
[warn]   For better performance, hit [ENTER] to switch to interactive mode, or
[warn]   consider launching sbt without any commands, or explicitly passing 'shell'
[info] Loading project definition from /Users/henrik/Private/RaceCalendar/web/project
[info] Set current project to Race Calendar (in build file:/Users/henrik/Private/RaceCalendar/web/)
[info] Updating {file:/Users/henrik/Private/RaceCalendar/web/}root...
[info] Done updating.
[info] Compiling 6 Scala sources and 1 Java source to /Users/henrik/Private/RaceCalendar/web/target/scala-2.11/classes...
[info] Typescript linting on 3 source(s)
[info] Typescript compiling on 3 source(s)
[error] /Users/henrik/Private/RaceCalendar/web/target/web/node-modules/main/webjars/@angular/compiler/src/aot/static_reflector.d.ts:8: TS2422 A class may only implement another class or interface.
[error] export declare class StaticReflector implements ReflectorReader {
[error]                                                 ^
[error] /Users/henrik/Private/RaceCalendar/web/target/web/node-modules/main/webjars/@angular/core/src/util/decorators.d.ts:11: TS2411 Property 'extends' of type 'Type<any> | undefined' is not assignable to string index type 'Function | any[] | Type<any>'.
[error]     extends?: Type<any>;
[error]     ^
[error] /Users/henrik/Private/RaceCalendar/web/target/web/node-modules/main/webjars/@angular/platform-browser/src/dom/dom_renderer.d.ts:30: TS2420 Class 'DomRenderer' incorrectly implements interface 'Renderer'.
[error]   Types of property 'animate' are incompatible.
[error]     Type '(element: any, startingStyles: AnimationStyles | undefined, keyframes: (AnimationKeyframe | undef...' is not assignable to type '(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number,...'.
[error]       Type 'AnimationPlayer | undefined' is not assignable to type 'AnimationPlayer'.
[error]         Type 'undefined' is not assignable to type 'AnimationPlayer'.
[error] export declare class DomRenderer implements Renderer {
[error]                      ^
[error] /Users/henrik/Private/RaceCalendar/web/target/web/node-modules/main/webjars/@angular/platform-browser/src/dom/web_animations_driver.d.ts:12: TS2420 Class 'WebAnimationsDriver' incorrectly implements interface 'AnimationDriver'.
[error]   Types of property 'animate' are incompatible.
[error]     Type '(element: any, startingStyles: AnimationStyles | undefined, keyframes: (AnimationKeyframe | undef...' is not assignable to type '(element: any, startingStyles: AnimationStyles | undefined, keyframes: (AnimationKeyframe | undef...'. Two different types with this name exist, but they are unrelated.
[error]       Type 'WebAnimationsPlayer' is not assignable to type 'AnimationPlayer'.
[error]         Types of property 'parentPlayer' are incompatible.
[error]           Type 'AnimationPlayer | undefined' is not assignable to type 'AnimationPlayer'.
[error]             Type 'undefined' is not assignable to type 'AnimationPlayer'.
[error] export declare class WebAnimationsDriver implements AnimationDriver {
[error]                      ^
[error] /Users/henrik/Private/RaceCalendar/web/target/web/node-modules/main/webjars/@angular/platform-browser/src/dom/web_animations_player.d.ts:3: TS2422 A class may only implement another class or interface.
[error] export declare class WebAnimationsPlayer implements AnimationPlayer {
[error]                                                     ^
[error] 5 errors found
[error] (web-assets:typescript) com.typesafe.sbt.web.CompileProblemsException
[error] Total time: 15 s, completed May 22, 2017 4:49:14 PM
embo-2:web henrik$ sbt test
[warn] Executing in batch mode.
[warn]   For better performance, hit [ENTER] to switch to interactive mode, or
[warn]   consider launching sbt without any commands, or explicitly passing 'shell'
[info] Loading project definition from /Users/henrik/Private/RaceCalendar/web/project
[info] Set current project to Race Calendar (in build file:/Users/henrik/Private/RaceCalendar/web/)
[info] Exporting web-assets:race-calendar
[info] Compiling 3 Scala sources to /Users/henrik/Private/RaceCalendar/web/target/scala-2.11/test-classes...
[info] Typescript test linting on 1 source(s)
[info] Typescript test compiling on 1 source(s)
[error] /Users/henrik/Private/RaceCalendar/web/target/web/node-modules/main/webjars/@angular/core/src/util/decorators.d.ts:11: TS2411 Property 'extends' of type 'Type<any> | undefined' is not assignable to string index type 'Function | any[] | Type<any>'.
[error]     extends?: Type<any>;
[error]     ^
[error] /Users/henrik/Private/RaceCalendar/web/test/assets/app.component.spec.ts:2: TS2305 Module '"/Users/henrik/Private/RaceCalendar/web/target/web/node-modules/main/webjars/@angular/core/testing/index"' has no exported member 'describe'.
[error]     describe,
[error]     ^
[error] two errors found
[error] (web-assets-test:typescript) com.typesafe.sbt.web.CompileProblemsException
[error] Total time: 12 s, completed May 22, 2017 4:49:36 PM
embo-2:web henrik$ sbt test
[warn] Executing in batch mode.
[warn]   For better performance, hit [ENTER] to switch to interactive mode, or
[warn]   consider launching sbt without any commands, or explicitly passing 'shell'
[info] Loading project definition from /Users/henrik/Private/RaceCalendar/web/project
[info] Set current project to Race Calendar (in build file:/Users/henrik/Private/RaceCalendar/web/)
[info] Exporting web-assets:race-calendar
[info] Exporting web-assets-test:race-calendar
[info] ApplicationTest:
[info] A Unittest
[info] - must Work
[info] RouteTest:
[info] GET /
[info] - should return result
[info] IndexControllerTest:
[info] Index controller
[info] - should return valid response
[info] ScalaTest
[info] Run completed in 4 seconds, 190 milliseconds.
[info] Total number of tests run: 3
[info] Suites: completed 3, aborted 0
[info] Tests: succeeded 3, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[info] Passed: Total 3, Failed 0, Errors 0, Passed 3
[success] Total time: 8 s, completed May 22, 2017 4:49:53 PM
embo-2:web henrik$ 

@joost-de-vries
Copy link
Owner

Hi Henrik,

Interesting point. I've been working towards full support for ts unit tests. The first step was to be able to compile ts tests. The next step was to implement sbt-jasmine to be able to run them. I never got around to the 3rd step of changing this ng2 demo project because I'm currently not doing a project with ng2 and ng2 is a framework so setting up for the framework to run before you run your tests takes a bit of research.

But together we should be able to implement it. I can set up a simple ts jasmine test to run. And then you can take care of the ng2 test setup.

@hkirk
Copy link
Author

hkirk commented May 23, 2017

Which ng2 demo project are you refering to?

@joost-de-vries
Copy link
Owner

This one. 😄

@joost-de-vries
Copy link
Owner

I updated the project with an example jasmine test. Do you want to make a PR with real Angular tests?

@joost-de-vries
Copy link
Owner

Just let me know when you have a PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants