Installation

You can work on the UI without needing a VM, by using web-server.js. There are a few limitations, such as login not being available, but it works well enough for quick testing. For instructions on how to serve the UI with working URL rewriting, see the Vagrant instructions.

Cloning the Repo

Running the web-server

  • Install Node.js and Yarn if not present.

  • yarn install --no-bin-links to install all dependencies.

  • Open a shell, cd into the root of the repository you just cloned and type:

    ./web-server.js
    

Viewing the UI

Once the server is running, you can navigate to: http://localhost:8000

Configuration

By default, the web server will serve data from treeherder production. If you wish to test the UI against treeherder stage instead, type:

./web-server.js --stage

If you wish to test the UI against a custom service, type:

./web-server.js --server <url>

Please note that if ui/js/config/local.conf.js exists, the above configuration will be overwritten by thServiceDomain in the config file.

If you wish to run the full treeherder Vagrant project (service + UI), remember to remove local.conf.js or else change thServiceDomain within it to refer to vagrant, so the UI will use the local Vagrant service API.

Validating JavaScript

We run our JavaScript code in the frontend through eslint to ensure that new code has a consistent style and doesn’t suffer from common errors. Before submitting a patch, check that your code passes these tests.

  • If you haven’t already done so, install local dependencies by running yarn install --no-bin-links from the project root.
  • Run yarn run lint.

Running the unit tests

The unit tests for the UI are run with Karma. To do this:

  • If you haven’t already done so, install local dependencies by running yarn install --no-bin-links from the project root.
  • Run yarn test.