Skip to content

Commit f341c53

Browse files
committed
Move testing out of docs
Fixes #564.
1 parent a88d75f commit f341c53

File tree

2 files changed

+69
-37
lines changed

2 files changed

+69
-37
lines changed

README.md

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ const db = new Database();
4747
var arangojs = require("arangojs");
4848
var db = new arangojs.Database();
4949
var now = Date.now();
50-
db
51-
.query({
52-
query: "RETURN @value",
53-
bindVars: { value: now }
54-
})
50+
db.query({
51+
query: "RETURN @value",
52+
bindVars: { value: now }
53+
})
5554
.then(function(cursor) {
5655
return cursor.next().then(function(result) {
5756
// ...
@@ -66,6 +65,62 @@ db
6665

6766
[Latest Documentation](https://docs.arangodb.com/devel/Drivers/JS/)
6867

68+
## Testing
69+
70+
Run the tests using the `yarn test` or `npm test` commands:
71+
72+
```sh
73+
yarn test
74+
# - or -
75+
npm test
76+
```
77+
78+
By default the tests will be run against a server listening on
79+
`http://localhost:8529` (using username `root` with no password). To
80+
override this, you can set the environment variable `TEST_ARANGODB_URL` to
81+
something different:
82+
83+
```sh
84+
TEST_ARANGODB_URL=http://myserver.local:8530 yarn test
85+
# - or -
86+
TEST_ARANGODB_URL=http://myserver.local:8530 npm test
87+
```
88+
89+
For development arangojs tracks the development build of ArangoDB. This means
90+
tests may reflect behavior that does not match any existing public release of
91+
ArangoDB.
92+
93+
To run tests for a specific release of ArangoDB other than the latest
94+
development build, use the environment variable `ARANGO_VERSION`, e.g. for 3.3:
95+
96+
```sh
97+
ARANGO_VERSION=30300 yarn test
98+
# - or -
99+
ARANGO_VERSION=30300 npm test
100+
```
101+
102+
The value follows the same format as the `arangoVersion` config option,
103+
i.e. XYYZZ where X is the major version, YY is the two digit minor version
104+
and ZZ is the two digit patch version (both zero filled to two digits).
105+
106+
Any incompatible tests will appear as skipped (not failed) in the test result.
107+
108+
To run the resilience/failover tests you need to set the environment variables
109+
`RESILIENCE_ARANGO_BASEPATH` (to use a local build of ArangoDB) or
110+
`RESILIENCE_DOCKER_IMAGE` (to use a docker image by name):
111+
112+
```sh
113+
RESILIENCE_ARANGO_BASEPATH=../arangodb yarn test
114+
# - or -
115+
RESILIENCE_ARANGO_BASEPATH=../arangodb npm test
116+
```
117+
118+
This runs only the resilience/failover tests, without running any other tests.
119+
120+
Note that these tests are generally a lot slower than the regular test suite
121+
because they involve shutting down and restarting individual ArangoDB server
122+
instances.
123+
69124
## License
70125

71126
The Apache License, Version 2.0. For more information, see the accompanying

docs/Drivers/JS/GettingStarted/README.md

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ The version number of this driver does not indicate supported ArangoDB versions!
3434

3535
This driver uses semantic versioning:
3636

37-
* A change in the bugfix version (e.g. X.Y.0 -> X.Y.1) indicates internal
37+
- A change in the bugfix version (e.g. X.Y.0 -> X.Y.1) indicates internal
3838
changes and should always be safe to upgrade.
39-
* A change in the minor version (e.g. X.1.Z -> X.2.0) indicates additions and
39+
- A change in the minor version (e.g. X.1.Z -> X.2.0) indicates additions and
4040
backwards-compatible changes that should not affect your code.
41-
* A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_
41+
- A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_
4242
changes that require changes in your code to upgrade.
4343

4444
If you are getting weird errors or functions seem to be missing, make sure you
@@ -58,27 +58,6 @@ You can find the documentation for each version by clicking on the corresponding
5858
date on the left in
5959
[the list of version tags](https://github.com/arangodb/arangojs/tags).
6060

61-
## Testing
62-
63-
Run the tests using the `yarn test` or `npm test` commands:
64-
65-
```sh
66-
yarn test
67-
# - or -
68-
npm test
69-
```
70-
71-
By default the tests will be run against a server listening on
72-
`http://localhost:8529` (using username `root` with no password). To
73-
override this, you can set the environment variable `TEST_ARANGODB_URL` to
74-
something different:
75-
76-
```sh
77-
TEST_ARANGODB_URL=http://myserver.local:8530 yarn test
78-
# - or -
79-
TEST_ARANGODB_URL=http://myserver.local:8530 npm test
80-
```
81-
8261
## Install
8362

8463
### With Yarn or NPM
@@ -170,11 +149,10 @@ const db = new Database();
170149
var arangojs = require("arangojs");
171150
var db = new arangojs.Database();
172151
var now = Date.now();
173-
db
174-
.query({
175-
query: "RETURN @value",
176-
bindVars: { value: now }
177-
})
152+
db.query({
153+
query: "RETURN @value",
154+
bindVars: { value: now }
155+
})
178156
.then(function(cursor) {
179157
return cursor.next().then(function(result) {
180158
// ...
@@ -230,15 +208,14 @@ If the request failed at a network level or the connection was closed without re
230208
```js
231209
// Using async/await
232210
try {
233-
const info = await db.createDatabase('mydb');
211+
const info = await db.createDatabase("mydb");
234212
// database created
235213
} catch (err) {
236214
console.error(err.stack);
237215
}
238216

239217
// Using promises with arrow functions
240-
db.createDatabase('mydb')
241-
.then(
218+
db.createDatabase("mydb").then(
242219
info => {
243220
// database created
244221
},

0 commit comments

Comments
 (0)