Skip to content
Permalink
Browse files
[FLAGON-380] Updated Build and Test page to reflect current documenta…
…tion. Also updated troubleshooting with minor edits
  • Loading branch information
poorejc committed Apr 20, 2019
1 parent 3325d87 commit 6a86685748649aaf86dc60c1b1efeabdeba97abe
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 14 deletions.
@@ -1,26 +1,118 @@
---
title: Build and Test
component: useralejs
permalink: /docs/useralejs/build
priority: 11
---

### Building UserALE.js

To modify and build your own version of ``UserALE.js``, first clone the repo, install all dependencies, and make any desired changes. Then build and minify into the build/ folder:
To build [Apache UserALE.js](https://github.com/apache/incubator-flagon-useralejs/tree/master), you will need to clone our repo and install [NPM and Node.js](https://nodejs.org/).

```shell
git clone https://github.com/apache/incubator-senssoft-useralejs.git
npm install
npm run build
```
UserALE.js utilizes NPM for package and dependency management. Execute the following to install dependencies.
```
#install required packages
npm install
### Testing and Linting
#review major dependencies
npm ls --depth=0
```

We maintain code quality through linting and our test suite. To run, or run and watch for changes:
## Build

```shell
npm test
npm run example:watch
```
UserALE.js uses Gulp to manage build tasking. These tasks are executed through our build script; use the following to execute:

See ``package.json`` for full script options.
```
#Build UserALE.js
npm run build
```

## Test

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:
```
...
attachHandlers
✓ attaches all the event handlers without duplicates
✓ debounces bufferedEvents (505ms)
defineDetails
- configures high detail events correctly
configure
✓ merges new configs into main config object
✓ includes a userid if present in the window.location
getUserIdFromParams
✓ fetches userId from URL params
✓ returns null if no matching param
getInitialSettings
timeStampScale
✓ no event.timestamp
✓ zero
✓ epoch milliseconds
✓ epoch microseconds
✓ performance navigation time
getInitialSettings
✓ 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
packageLogs
setLogFilter
✓ assigns the handler to the provided value
✓ allows the handler to be nulled
setLogMapper
✓ assigns the handler to the provided value
✓ allows the handler to be nulled
packageLog
✓ 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
extractTimeFields
✓ returns the millisecond and microsecond portions of a timestamp
✓ sets micro to 0 when no decimal is present
✓ always returns an object
getLocation
✓ returns event page location
✓ calculates page location if unavailable
✓ fails to null
selectorizePath
✓ returns a new array of the same length provided
getSelector
✓ builds a selector
✓ identifies window
✓ handles a non-null unknown value
buildPath
✓ builds a path
✓ defaults to path if available
sendLogs
✓ 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](https://issues.apache.org/jira/projects/FLAGON).

Further instructions can be found in our [README](https://github.com/apache/incubator-flagon-useralejs/blob/master/README.md)
@@ -1,10 +1,11 @@
---
title: Troubleshooting
component: useralejs
permalink: /docs/useralejs/troubleshooting
---

### Enable Cross-Origin Resource Sharing (CORS)

The logs generated by UserALE is sent to a logging server which is configured in the script tag. Your client may send out failure logs because of a CORS (cross-origin resource sharing) issue. You will need to configure your backend server to enable CORS.
The logs generated by [Apache UserALE.js](https://github.com/apache/incubator-flagon-useralejs) are sent to a logging server which is configured in the script tag. Your client may send out failure logs because of a CORS (cross-origin resource sharing) issue. You will need to configure your backend server to enable CORS.

For more information and examples on how to enable CORS on your server, please visit [enable-cors.org](http://enable-cors.org/index.html).

0 comments on commit 6a86685

Please sign in to comment.