Re: Testing native @JsType in GWT tests

2018-03-12 Thread Mincong Huang
I tried the -ea flag (checkAssertions in the POM). It seems to be incompatible with the flag productionMode. I guess when production mode is true, assertions are disabled. I ended up with two test executions in my POM: "jsni-test" for keeping the type checked for legacy JSNI codes, and

Re: Testing native @JsType in GWT tests

2018-03-12 Thread Thomas Broyer
On Monday, March 12, 2018 at 9:17:58 AM UTC+1, Mincong Huang wrote: > > Thanks, Thomas. Changing to production mode fixed the problem. > > However, I noticed that when using production mode in tests, I cannot test > the type-matching for JSNI anymore. Previously, the GWT generated interface >

Re: Testing native @JsType in GWT tests

2018-03-12 Thread Mincong Huang
Thanks, Thomas. Changing to production mode fixed the problem. However, I noticed that when using production mode in tests, I cannot test the type-matching for JSNI anymore. Previously, the GWT generated interface code caught the problem at runtime in development mode. When running in production

Re: Testing native @JsType in GWT tests

2018-03-11 Thread Thomas Broyer
JsInterop doesn't work in legacy DevMode; you have to run the tests in production mode: https://gwt-maven-plugin.github.io/gwt-maven-plugin/test-mojo.html#productionMode (this is the default in GWT 2.8, but Mojo's Maven plugin for GWT forces legacy DevMode by default; may I suggest that you

Re: Testing native @JsType in GWT tests

2018-03-11 Thread Mincong Huang
Hi Vassilis, Thanks for your help. After having specified the TOP_WINDOW as you suggested, the test passed in IntelliJ IDEA. However, it is still failing via Maven plugin [1]. I don't understand any more... Mincong [1]: https://travis-ci.org/mincong-h/learning-gwt/jobs/352049257#L769 On Sun,

Re: Testing native @JsType in GWT tests

2018-03-11 Thread Vassilis Virvilis
I would guess that script injector injects by default inside gwt frame. You need to specify TOP_WINDOW because jsinterop are mapped to $wnd by default. Something like that (can't test right now) ScriptInjector.fromString(js).setWindow(ScriptInjector.TOP_WINDOW).inject(); If you do this then