With Yarn or NPM
yarn add arangojs## - or -npm install --save arangojs
git clone https://github.com/arangodb/arangojs.gitcd arangojsnpm installnpm run dist
Basic usage example
error TS2304: Cannot find name 'Blob'.
Even if your project doesn't contain any browser code, you need to add
"lib" array in your
tsconfig.json to make arangojs work. This is a
known limitation because the library supports both browser and Node
environments and there is no common binary format that works in
// tsconfig.json- "lib": ["es6"],+ "lib": ["es6", "dom"],
ReferenceError: window is not defined
If you compile your Node project using a build tool like Webpack, you may need to tell it to target the correct environment:
// webpack.config.js+ "target": "node",
To support use in both browser and Node environments arangojs uses the
to substitute browser-specific implementations for certain modules.
Build tools like Webpack will respect this field when targetting a browser
environment and may need to be explicitly told you are targetting Node instead.
Run the tests using the
yarn test or
npm test commands:
yarn test# - or -npm test
By default the tests will be run against a server listening on
http://localhost:8529 (using username
root with no password). To
override this, you can set the environment variable
TEST_ARANGODB_URL=http://myserver.local:8530 yarn test# - or -TEST_ARANGODB_URL=http://myserver.local:8530 npm test
For development arangojs tracks the development build of ArangoDB. This means tests may reflect behavior that does not match any existing public release of ArangoDB.
To run tests for a specific release of ArangoDB other than the latest
development build, use the environment variable
ARANGO_VERSION, e.g. for 3.3:
ARANGO_VERSION=30300 yarn test# - or -ARANGO_VERSION=30300 npm test
The value follows the same format as the
arangoVersion config option,
i.e. XYYZZ where X is the major version, YY is the two digit minor version
and ZZ is the two digit patch version (both zero filled to two digits).
Any incompatible tests will appear as skipped (not failed) in the test result.
To run the resilience/failover tests you need to set the environment variables
RESILIENCE_ARANGO_BASEPATH (to use a local build of ArangoDB) or
RESILIENCE_DOCKER_IMAGE (to use a docker image by name):
RESILIENCE_ARANGO_BASEPATH=../arangodb yarn test# - or -RESILIENCE_ARANGO_BASEPATH=../arangodb npm test
This runs only the resilience/failover tests, without running any other tests.
Note that these tests are generally a lot slower than the regular test suite because they involve shutting down and restarting individual ArangoDB server instances.
The Apache License, Version 2.0. For more information, see the accompanying LICENSE file.