简体   繁体   中英

What's the standard way of including dependencies for your JavaScript tests?

I'm pretty new to JavaScript, and am wondering what's the standard/recommended way of including dependencies (eg Jasmine, jQuery) when writing tests for a JavaScript library? I'm using Jasmine as the test framework FWIW. Would it for instance be recommended to include libraries being depended on in the source tree?

I would recommend that you get started by simply including the dependencies in the HTML runner file via <script> tags. This isn't the only way, but it will get you started faster than any other method.

Also, since you are just starting, you might also want to consider trying Mocha. Here is an example mocha runner:

http://visionmedia.github.com/mocha/example/tests.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM