Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with NativeScript

You're reading from   Getting Started with NativeScript Explore the possibility of building truly native, cross-platform mobile applications using your JavaScript skill—NativeScript!

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785888656
Length 168 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Nathanael J. Anderson Nathanael J. Anderson
Author Profile Icon Nathanael J. Anderson
Nathanael J. Anderson
Arrow right icon
View More author details
Toc

Test frameworks


There are several different testing frameworks for JavaScript. So, if you have your own favorite testing framework, most of this advice would also apply to it. In this case, we will use Mocha. It is a fairly popular testing framework, so you can easily find many samples and examples on how to use it on the mochajs.org website. However, we will get you up and running with NativeScript. The first thing you need to do is open a terminal shell and install mocha with the npm install –g mocha command. The -g option will tell npm to install mocha globally, just like we did when we installed the nativescript command. By making it globally available, you can run it just by typing mocha anywhere.

Note

Mocha is a JavaScript testing framework. This framework runs under node, so everything we are doing with the testing is all using node-based code. This might be confusing sometimes as JavaScript is simpler compared to NativeScript. So, even though we are loading and testing our code that...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime