refactor-864370: Update test commands

Changes:
* Move test command from lib/test/commands to lib/gcli/commands since
  it depends on GCLI.
* Convert it to use the exports.items syntax
* Add 'suite' param to server side version of same command.
* Simplify command line test output

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Several tidy-ups (see details)

A number of issues fixed:
* Add requisition.getStatusMessage() which will return the biggest error
  from a requisition
* Add Status.fromString(str) for deserializing status messages
* Expose helpers.arrayIs(arr1, arr2, desc) for test modules to use
* Fix syntax error in examiner.suites which was causing test suite
  completion to fail.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Create custom command serializers

Perviously we the contained things that were not JSONable. Now they
should not.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Chrome console breakage

"var f = console.log; f('hi');" is broken on chrome. This is a
workaround.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Add missing returns from unit tests

helpers.audit returns a promise of completion. If the tests complete
synchronously, this can be missed out, but doing so runs the risk that
a test will later become asynchronous. So it's better to have them in.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Clearer flags for tests

Be clearer about what environment we are running in by explicitly
setting isNode, isFirefox, etc.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Allow easy upgrading of nodes modules

There will be a growing number of cases where we want to override the
implementation of modules in GCLI for the web, when GCLI is used in
NodeJS. This makes that process easier.

(Skip FF review)

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: s/skipArgUpdate/internal

Requisition.setAssignment had a skipArgUpdate option which obviously
skipped the 'arg update' process. This processing is needed when
setAssignment is being called from outside of a Requisition, but not
when it is an internal part of a call to update(). Since we are about
to add other processing with the same internal/extenal switch it seems
sensible to rename the option.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Use property for assignments

Previously Arguments and Conversions were set with an assign(…) function
but read with a property. This was confusing, and part of some bug
hunting so this change makes us use properties for get and set.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Refactor setAssignmentInternal

It now returns a promise so setAssignment can return it directly.
Also it's now declared as a var and bound so we can use it in a 'then'
clause. Also it's better commented.
No functionality changes.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Unnest 'if's. Use return instead

The logic in Requisition.assign is complex and can be simplified by
reducing the indents and using return.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Introduce updateIds to Requisition

Calls to update() and setAssignment() happen asynchronously, which means
we could call update twice before the first has completed. This change
adds an updateId which tracks a count of the changes so we can bail out
if we notice that the current change id is greater than the one we're
working on.

This (partially, see the next changeset) fixes an old bug, which wasn't
really noticeable until file types brought genuinely slow parsing.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Tell callers to update about overtaking

If a call to update() is overtaken by something else then we may need to
take action (as is the case for UP/DOWN navigation to menus) This
exposes the a boolean (it worked/didn't work) to the callers of update()

Signed-off-by: Joe Walker <jwalker@mozilla.com>
filetype-767587: Add 'filesystem' module

Firefox and NodeJS have very similar filesystem APIs, with some similar
quirks. The filesystem module provides GCLI with a similar interface for
the 2 with some additional quirks ironed out, and made nicer for our
uses.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
filetype-767587: Add 'fileparser' module.

The file parser module uses the filesystem module in the case of NodeJS
and Firefox (and XHR in the case of the web) to provide implementations
of 'parse' and 'getPredictions' for the file type.

The file type is a bit of a spiders-web, but there isn't a nice solution
yet. The core of the problem is that the modules used by Firefox and
NodeJS intersect with the modules used by the web, but not each other.
Except here.
So we have to do something fancy to get the sharing but not mess up the
web.

The 'file' type will require 'gcli/types/fileparser', and there are 4
implementations of this:
* '/lib/gcli/types/fileparser.js', the default web version that uses
  XHR to talk to the node server
* '/lib/server/gcli/types/fileparser.js', an NodeJS stub, and ...
* '/mozilla/gcli/types/fileparser.js', the Firefox implementation both
  of these are shims which import
* 'util/fileparser', which does the real work, except the actual file
  access

The file access comes from the 'util/filesystem' module, and there are 2
implementations of this:
* '/lib/server/util/filesystem.js', which uses NodeJS APIs
* '/mozilla/util/filesystem.js', which uses OS.File APIs

Signed-off-by: Joe Walker <jwalker@mozilla.com>
filetype-767587: Add a 'file' type

This builds on the fileparser module to add a file type. It also adds
tests and demo commands, etc.

Signed-off-by: Joe Walker <jwalker@mozilla.com>