Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Orion/Node/Developing

< Orion‎ | Node
Revision as of 17:40, 16 January 2014 by Unnamed Poltroon (Talk) (Minification for speed and profit)

This page explains how to develop the experimental Node.js-based Orion server. See Orion/Node/Getting started for an introduction.

Running the tests

Our unit tests are written against the Mocha test framework.

From the org.eclipse.orion.client/modules/orionode directory, just run the command:

 npm test

This will invoke Mocha and produce console output showing which tests passed and failed. Orion-Node-Developing-testrun.png


If you didn't install the Mocha package globally (or if you want to pass custom arguments to Mocha), run this instead:

 ./node_modules/mocha/bin/mocha [debug] [options] [files]

To make this easier, you can install Mocha as a global npm package (npm install mocha -g), and then invoke it as simply mocha from a command shell.

Writing more tests

When you're prototyping a new feature, writing unit tests for it is always a good idea. Here's how to write a test:

  1. Create a new file my_tests.js in the org.eclipse.orion.client/modules/orionode/test/ directory.
  2. Write your tests in the file. Here are two resources to help you get started:
  3. Run the tests (see instructions above).
    • You don't have to register your new tests with the framework; it will discover anything in the test/ directory automatically.

Helper data or classes should go in test/support/.

Minification for speed and profit*

Minification can be performed on the client code. This greatly reduces load times when accessing the server. To generate a minified copy of the repository, run the shell script make-publish.sh from the modules/orionode/build/ directory:

$ cd modules/orionode/build
$ ./make-publish.sh /path/to/tempDir

make-publish.sh takes a single argument, which is the output directory where the minified server will be saved. Everything in the output directory gets deleted first, so don't use an important folder.

We publish minified builds of the Node server to the npm repository on a regular basis.

* Profit not guaranteed

Back to the top