partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
248 stars 61 forks source link

Running Unit Tests in KekuleJS #185

Closed rfedor-macmillan closed 4 years ago

rfedor-macmillan commented 4 years ago

Good Day @partridgejiang,

I'm in the process of looking to see how to run the unit tests on the library and was wondering if you can share any details on how to accomplish that? We're wanting to verify changes our branch but have little details on how they're ran and how to debug failures through the those test cases.

Thank you, Roger

partridgejiang commented 4 years ago

Sorry for the delay of replying. To run the unit tests, you can simply open the HTML files (testRunner_XXXX.html) in browser, then wait for the result. If anything fails, as normal JavaScript application, error information can be found in the console panel of browser.

rfedor-macmillan commented 4 years ago

Thanks for the response, is there any way to execute all the tests from command line to support continuous integration?

partridgejiang commented 4 years ago

The unit test project are based on Jasmine, which does support both web and node environment. However, all of the tests requiring external data file are written in a AJAX way currently, so they have to be modified to utilizing fs in node. I'll check them soon.

rdfedor commented 4 years ago

Great, thank you.

partridgejiang commented 4 years ago

The unit tests has been ported to command line environment now. Firstly install Jasmine cli tool by npm install -g jasmine, then the unit tests can be launched by calling jasmine at the unitTests directory. Some source file modifications have been made to adapt to Node environment, so please update the project with latest two commits.

rfedor-macmillan commented 4 years ago

Thank you, this will help a lot in ensuring a reliable build.