Comments (6)
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.
from play-angular-typescript.g8.
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$
from play-angular-typescript.g8.
Which ng2 demo project are you refering to?
from play-angular-typescript.g8.
This one. 😄
from play-angular-typescript.g8.
I updated the project with an example jasmine test. Do you want to make a PR with real Angular tests?
from play-angular-typescript.g8.
Just let me know when you have a PR
from play-angular-typescript.g8.
Related Issues (20)
- Problem with the third option: app/bootstrap not found HOT 1
- coursier.ResolutionException: Conflict(s) in dependency resolution HOT 2
- Property not passed to the top level component HOT 2
- Support scss instead of css HOT 1
- Update the readme for latest changes
- Migrating from SBT to Maven HOT 1
- Running test under karma with jasmine HOT 1
- Unexpected exception languageServiceHost.js:21 ReferenceError: Map is not defined HOT 3
- how to use libarary.such as ng2-bootstrap HOT 1
- Tslint show JsFailure message "Set is not defined". HOT 1
- Links broken HOT 2
- Dependencies are broken HOT 3
- empty lib directory HOT 1
- activator error , please help me, thanks a lot HOT 2
- unresolved dependency: org.webjars.npm#through HOT 1
- Runtime exception: Invalid regular expression HOT 3
- Recommended IDE? HOT 1
- rxjs dependencies passed compilation but failed at runtime. HOT 3
- Sbt test cannot test running because find Linter.createProgram().
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from play-angular-typescript.g8.