lbialy / play-ng2-webpack2

Play 2.6.0 + Angular with Angular-CLI + SBT - based build
Other
55 stars 20 forks source link

Runnnig tests #9

Open hkirk opened 7 years ago

hkirk commented 7 years ago

I get the following error while running sbt test

>sbt test
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\guest-hkir\Documents\play-ng2-webpack2\project
[info] Set current project to play-ng (in build file:/C:/Users/guest-hkir/Documents/play-ng2-webpack2/)

> ui@0.0.0 build C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui
> ng build --extract-css --progress --output-path ../public/ui

Hash: dc9e1cd4ceb875d9788f
Time: 7356ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 232 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.js.map (main) 4.89 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.css, styles.bundle.css.map (styles) 69 bytes {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.39 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]

> ui@0.0.0 test-no-watch C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui
> ng test --single-run

 10% building modules 1/1 modules 0 active06 06 2017 10:55:19.253:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9876/
06 06 2017 10:55:19.255:INFO [launcher]: Launching browser Chrome with unlimited concurrency
06 06 2017 10:55:19.260:INFO [launcher]: Starting browser Chrome
06 06 2017 10:55:24.949:ERROR [karma]: Error: C:/Users/guest-hkir/Documents/play-ng2-webpack2/ui/node_modules/@angular/core/src/testability/testability.d.ts (41,33): Cannot find name 'Node'.
    at Compiler.compiler.plugin (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\@angular\cli\plugins\karma-webpack-throw-error.js:10:23)
    at Compiler.applyPlugins (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\tapable\lib\Tapable.js:61:14)
    at Watching._done (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\webpack\lib\Compiler.js:92:17)
    at onCompiled (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\webpack\lib\Compiler.js:51:17)
    at C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\webpack\lib\Compiler.js:494:13
    at next (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\tapable\lib\Tapable.js:138:11)
    at Compiler.<anonymous> (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\webpack\lib\CachePlugin.js:62:5)
    at Compiler.applyPluginsAsyncSeries (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\tapable\lib\Tapable.js:142:13)
    at C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\webpack\lib\Compiler.js:491:10
    at Compilation.applyPluginsAsyncSeries (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\tapable\lib\Tapable.js:131:46)
    at self.applyPluginsAsync.err (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\webpack\lib\Compilation.js:645:19)
    at next (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\tapable\lib\Tapable.js:138:11)
    at Compilation.compilation.plugin (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\webpack\lib\ProgressPlugin.js:121:6)
    at Compilation.applyPluginsAsyncSeries (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\tapable\lib\Tapable.js:142:13)
    at self.applyPluginsAsync.err (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\webpack\lib\Compilation.js:636:11)
    at next (C:\Users\guest-hkir\Documents\play-ng2-webpack2\ui\node_modules\tapable\lib\Tapable.js:138:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ui@0.0.0 test-no-watch: `ng test --single-run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ui@0.0.0 test-no-watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\guest-hkir\AppData\Roaming\npm-cache\_logs\2017-06-06T08_55_25_386Z-debug.log
java.lang.Exception: UI tests failed!
        at $8bcc161bf26d71a48f28$$anonfun$$sbtdef$1.apply(C:\Users\guest-hkir\Documents\play-ng2-webpack2\build.sbt:69)
        at $8bcc161bf26d71a48f28$$anonfun$$sbtdef$1.apply(C:\Users\guest-hkir\Documents\play-ng2-webpack2\build.sbt:67)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
[error] (*:Run UI tests when testing application.) java.lang.Exception: UI tests failed!

Should note this is happening on both Windows and OSX. Any clues?

lbialy commented 7 years ago

This is new, possibly one of packages introduced breaking changes. I'll try to check what's going on tomorrow.

DPGrev commented 7 years ago

Hi, I encountered the same error as you and was able to fix it by editing the lib field in ui/src/tsconfig.spec.json to:

"lib": [
  "es2016",
  "dom"
]

Since I updated to angular 4.2.4 and also updated the supporting packages I also got 2 other errors when running sbt test. These can be fixed in the following way.:

Error 1

[00:27:47] I/launcher - Running 1 instances of WebDriver
[00:27:47] I/direct - Using ChromeDriver directly...
[00:27:47] E/direct - Error code: 135
[00:27:47] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[00:27:47] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.

This error can be fixed by adding the following the scripts in the package.json:

"scripts": {
  "webdriver-update": "webdriver-manager update"
}

and then running npm run webdriver-update in the ui folder.

Error 2

[01:51:40] I/launcher - Running 1 instances of WebDriver
[01:51:40] I/direct - Using ChromeDriver directly...
[01:51:42] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript
e2e/app.e2e-spec.ts (12,45): Argument of type '"IT WORKS! - SASS + TS = <3"' is not assignable to parameter of type 'Expected<Promise<string>>'. (2345)

This error is an ongoing problem see: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15215

A temporary fix is to add <any> after expect in ui/e2e/app.e2e-spec.ts:

expect<any>(page.getParagraphText()).toEqual('IT WORKS! - SASS + TS = <3');

However there probably are more elegant fixes for this.