UserALE.js Build and Test

To build Apache UserALE.js, you will need to clone our repo and install NPM and Node.js.

UserALE.js utilizes NPM for package and dependency management. Execute the following to install dependencies.

#install required packages
npm install

#review major dependencies
npm ls --depth=0


UserALE.js uses Gulp to manage build tasking. These tasks are executed through our build script; use the following to execute:

#Build UserALE.js
npm run build


UserALE.js uses JSDOM and Mocha to execute unit tests, which are integrated into our build pipeline. See package.json for full script options.

To run tests:

#Run UserALE.js unit tests
npm run test

… you’ll see something like:

    ✓ attaches all the event handlers without duplicates
    ✓ debounces bufferedEvents (505ms)
      - configures high detail events correctly

    ✓ merges new configs into main config object
    ✓ includes a userid if present in the window.location
      ✓ fetches userId from URL params
      ✓ returns null if no matching param

      ✓ no event.timestamp
      ✓ zero
      ✓ epoch milliseconds
      ✓ epoch microseconds
      ✓ performance navigation time
      ✓ fetches all settings from a script tag (122ms)
      ✓ grabs user id from params

  Userale API
    ✓ provides configs
    ✓ edits configs
    ✓ starts + stops (214ms)
    ✓ sends custom logs

      ✓ assigns the handler to the provided value
      ✓ allows the handler to be nulled
      ✓ assigns the handler to the provided value
      ✓ allows the handler to be nulled
      ✓ only executes if on
      ✓ calls detailFcn with the event as an argument if provided
      ✓ packages logs
      ✓ filters logs when a handler is assigned and returns false
      ✓ assigns logs to the mapper's return value if a handler is assigned
      ✓ does not call the map handler if the log is filtered out
      ✓ does not attempt to call a non-function filter/mapper
      ✓ returns the millisecond and microsecond portions of a timestamp
      ✓ sets micro to 0 when no decimal is present
      ✓ always returns an object
      ✓ returns event page location
      ✓ calculates page location if unavailable
      ✓ fails to null
      ✓ returns a new array of the same length provided
      ✓ builds a selector
      ✓ identifies window
      ✓ handles a non-null unknown value
      ✓ builds a path
      ✓ defaults to path if available

    ✓ sends logs on an interval
    ✓ does not send logs if the config is off
    ✓ sends logs on page exit with navigator
    ✓ sends logs on page exit without navigator
    ✓ does not send logs on page exit if config is off

  45 passing (954ms)
  1 pending

Any failing tests will also be logged in the terminal. If there are failing tests, please consider logging an issue in JIRA.

Further instructions can be found in our README