addTrigger = function (triggers, currentTrigger, affectedSpecs) {
  if (!triggers[currentTrigger]) {
    triggers[currentTrigger] = [];
  }
  triggers[currentTrigger] = _.uniq(triggers[currentTrigger].concat(affectedSpecs));
  return triggers;
}
affectedFiles

This program outputs a list of files affected by changes in other files that are in the former ones dependency tree.
The problem that inspired this program is to know what test files can be broken because of modifications on
another files in the code base. This way, we'll know the exact test files that we must run to check that
nothing breaks.

It needs a config file called `tree.config.json` with the next properties:
- testsFolder: the folder to build the dependency tree from. In our case, the specs folder.
  ex: "testsFolder": "lib/assets/test/spec/builder/"
- filesRegex: the regular expression for knowing what files must be taken into account for building the dependency tree.
  ex: "filesRegex": "spec\\.js$"

Input: the program needs a list of files to check against. See example below for an explanation.
Output: it outputs the list of affected files between the tags <affected></affected>

Example:
Say we have two spec files in folder specs/ with its own dependencies.

spec/
+
|-- foo.spec.js - require('lib/component'), require('lib/calendar'), require('lib/tools/dropdown')
|
|-- baz.spec.js - require('lib/whatever'), require('lib/calendar')

Run 1: What spec files are affected by a change in files 'lib/tools/dropdown.js' and 'lib/common/utils.js'? (It's only required in foo.spec.js dependency tree)
> affectedFiles lib/tools/drowndown.js lib/common/utils.js
  output
  <affected>
  spec/foo.spec.js
  </affected>

Run 2: What spec files are affected by a change in file 'lib/calendar.js'? (It's required in both specs)
> affectedFiles lib/tools/calendar.js
  output
  <affected>
  spec/foo.spec.js
  spec/baz.spec.js
  </affected>