ariatemplates / hashspace

JavaScript client-side template engine
http://hashspace.ariatemplates.com
Apache License 2.0
14 stars 18 forks source link

Report clear error message if playground samples don't compile #305

Open jakub-g opened 9 years ago

jakub-g commented 9 years ago

When running grunt docs:playground task, it fails with a fatal error when there's a hashspace compilation error of any of the samples, it should also be the case during the Travis build.

Because of lack of this check I managed to accidentally commit https://github.com/ariatemplates/hashspace/commit/aea451399cb687a17b5d1ce9675b20e25d8d6bdb which broke some playground samples, by not properly changing the braces in them (nbrfield and subtemplates) - which was then later fixed in https://github.com/ariatemplates/hashspace/commit/2fc1aecab9b367498147bcdeeba69501e82edab1#diff-1fc4b3e1876183acfc57f529b869b0e4

marclaval commented 9 years ago

PR #301 introduced tests for all samples of the playground. The runtime test suite in Karma should fail if there is such a compilation error. Isn't it the case ? Or do expect to have the compiler test suite in Mocha to fail also ?

PK1A commented 9 years ago

@mlaval is right here - with the new tests for samples the CI build should explode on an invalid template. I think that we can close this one unless we've got a specific example where things are not detected properly.

benouat commented 9 years ago

both @PK1A and @mlaval are true. with #301 grunt docs:playground will never be executed if the CI build explode... it is only executed in case of master build successful.

@jakub-g you can safely close it.

jakub-g commented 9 years ago

The PR you mentioned landed just after my commit I've probably done the checks without rebasing. You're right, currently when there's a syntax error in the hsp file, the tests are not passing, but the error reporting is far from ideal.

  1. Make a syntax error in some hsp file in playground
  2. Change gruntfile to enable DEBUG log level for karma
  3. Run npm test

What happens is: Firefox starts, waits for 10s and quits, but there's no clear error message what happened. So I'd keep this issue open to have better error logging in case of sample compilation error.

In this log, conditions.hsp is the file I deliberately changed to fail at compile time. There's no reporting on that in the log.

DEBUG [preprocessor.commonjs]: Processing "D:/gh/hashspace/docs/samples/component1/timer.hsp".
DEBUG [preprocessor.hsp]: Processing "D:/gh/hashspace/docs/samples/component2/nbrfield.hsp".
DEBUG [preprocessor.commonjs]: Processing "D:/gh/hashspace/docs/samples/component2/nbrfield.hsp".
DEBUG [preprocessor.hsp]: Processing "D:/gh/hashspace/docs/samples/component3/pagination.hsp".
DEBUG [preprocessor.commonjs]: Processing "D:/gh/hashspace/docs/samples/component3/pagination.hsp".
DEBUG [preprocessor.hsp]: Processing "D:/gh/hashspace/docs/samples/conditions/conditions.hsp".
DEBUG [preprocessor.hsp]: Processing "D:/gh/hashspace/docs/samples/cssclass/cssclass.hsp".
DEBUG [preprocessor.commonjs]: Processing "D:/gh/hashspace/docs/samples/cssclass/cssclass.hsp".
DEBUG [preprocessor.hsp]: Processing "D:/gh/hashspace/docs/samples/dynpath/dynpath.hsp".
...
DEBUG [preprocessor.commonjs]: Processing "D:/gh/hashspace/hsp/rt/tnode.js".
DEBUG [preprocessor.commonjs]: Processing "D:/gh/hashspace/hsp/utils/eventgenerator.js".
DEBUG [preprocessor.commonjs]: Processing "D:/gh/hashspace/hsp/utils/hashtester.js".
DEBUG [preprocessor.commonjs]: Processing "D:/gh/hashspace/hsp/utils/type.js".
DEBUG [web-server]: serving: D:\gh\hashspace\node_modules\karma\static/client.html
DEBUG [web-server]: serving: D:\gh\hashspace\node_modules\karma\static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/p2zmNJkuXVi7GEd6Vls4
DEBUG [karma]: A browser has connected on socket p2zmNJkuXVi7GEd6Vls4
INFO [Firefox 32.0.0 (Windows 7)]: Connected on socket p2zmNJkuXVi7GEd6Vls4 with id 19099132
DEBUG [launcher]: Firefox (id 19099132) captured in 3.262 secs
WARN [Firefox 32.0.0 (Windows 7)]: Disconnected (1 times), because no message in 10000 ms.

DEBUG [karma]: Run complete, exitting.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Process Firefox exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\Users\...\AppData\Local\Temp\karma-19099132
Warning: Task "karma:unit" failed. Use --force to continue.

Aborted due to warnings.
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0