The Fonteva Unit Testing Framework can be installed on Windows, Mac, or Linux. To install:

  1. Install nodejs - https://nodejs.org/en/ - nodejs allows you to run javascript on a server
    Install the latest version (presently version 10).
  2. npm is a package manager that should be installed along with nodejs. You can verify its installation with the command below.

    npm -v
    BASH


  3. Install Yarn - yarnpkg.com

Main Libraries

Fonteva's libraries allow you to execute your entire test/coverage suite or reinstall the suite to create a clean slate.

The main libraries are:

  • mocha - Allows you to do javascript unit testing. It's the same library that Salesforce uses in their testing framework and it's an industry-standard framework. This way, you don't have to be inside of Salesforce in order to run Lightning code. This allows you to run all of your tests offline; you can run about a thousand tests in three seconds (https://mochajs.org/).
  • chai - Assertion library (http://www.chaijs.com/).
  • sinon-chaiFonteva's mock utility. Anytime you are interacting with something, like window.location, or the document object, or the component object in Salesforce, Fonteva mocks that functionality out. For example, if you want to use $A.util.addclass, the suite executes that functionality because mocha is injected into Fonteva's testing framework (http://sinonjs.org/). 
  • lodash - A helper library that has lots of utility methods in it (https://lodash.com/).
  • istanbul - Fonteva's coverage library (https://istanbul.js.org/).

 

Previous: Unit Testing     |     Next: package.json