Skip to content

Setup for Angular app

msporna edited this page Jan 7, 2019 · 17 revisions

** ANGULAR IS NO LONGER SUPPORTED SINCE VERSION 3 **

This page lists steps required to make LAVA work with Angular project written in typescript.

  1. Do the initial setup: https://github.com/msporna/LAVA-test-coverage/wiki/Initial-setup
  2. Open src/config.json and update required fields:
source_root_absolute_path: [absolute path to /src folder]
web_routes_available: [list routes that can be visited by end user]
angular_main_file_name: [usually main.ts / just a filename not the path]
INJECT_MODE: "angular"

All paths must be absolute. For config details go to config.json-explained page.

  1. start LAVA server from /dashboard by executing the following command manually:
python instrument_server.py

or if you are on Windows you can simply run:

run_api_windows.bat
  1. go to /client folder and from your terminal run python instrument_client.py and pass config.json path as command line argument so the command becomes: python instrument_client.py config.json

  2. the process of injecting probes will start

  3. check your project's files, should be appended by instrumentation code

  4. your app's source folder will have instrument.js file (and index.html will be referencing it-done automatically) and lava_code_coverage folder

  5. compile .ts code by running 'npm run build' - make sure you are running the latest node and npm

  6. manually copy instrument.js and lava_test_coverage folder to the dist folder created during compilation

  7. deploy dist to desired web server (there is a Python web server in Lava root/examples/angular_demo)

related example: https://github.com/msporna/LAVA-test-coverage/tree/master/examples/angular_demo