- Make changes in the
/lib
directory, add a test to the/test
directory and runnpm test
. - Before sending a pull request for a feature or bug fix, be sure to have created tests.
- Use the same coding style as the rest of the codebase (see
.eslintrc.js
) - All pull requests should be made to the
master
branch.
You'll need at least one of the following databases/stores to get some tests working:
- Postgres
- Mysql
- SQLite3
- OpenLDAP
- ActiveDirectory
Clone the repository and install all dependencies via npm install
!
Here are a few npm commands to get started:
npm test
: Run all available tests via mocha and shouldnpm run lint
: Runs eslint for all javascript files in the/lib
and/tests
foldernpm run format
: formatts all javascript files with prettier.npm run coverage
: runs all tests and reports the test coverage via istanbulnpm run dev-docs
: runy docsify on port 4444
/lib
contains 3 folders and 3 javascript files:
/lib/base
: All the base functionality independent from the store type/lib/stores
: The code for all the specific store types/lib/graphql
: The graphql support code/lib/store.js
: The basic store class/lib/definiton.js
: The basic definition class/lib/utils.js
: The basic util functions
The store, definition, utils and model classes will be build based on the given store type on start.
Every file inside the /lib/base
and /lib/stores
folder will contain parts of the final classes.
See the docs to plugins.
There are different hooks/interceptors to change or add behaviour during initialisation, query or modify operations. These are defined via addInterceptor()
. See e.g. /lib/base/interceptors.js
.
By default all tests for SQLite3, Mysql and Postgres will run. If you only have a Postgres Database installed, you'll need to run only postgres tests via npm test -- --grep Postgres
. (--grep MySQL
for MySQL or --grep SQLite3
for SQLite3)
Tests for ldap
and rest
will run agains an internally started server on port 1389(ldap
) and 8889 (rest
).
These ports need to be free in order to run the tests!
It will use the default postgres
user. See the postgres test helper.
It will use the default root
user for the test setup. See the mysql test helper. All other tests will run with the travis
user.
- install the official mysql server for your system
- create the
travis
user for our tests
mysql -u root -p -e "CREATE USER 'travis'@'%' IDENTIFIED WITH 'mysql_native_password' BY '';";
mysql -u root -p -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;"
- alter the root user to allow the login without a password (for local development only!!!)
mysql -u root -p -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '';
It will create a new .sqlite file and removes it afterwards.
You'll need to specify the following ENV variables to start tests agains your ActiveDirectory:
AD_URL
: e.g. ldap://your.domainAD_USER
: e.g. DOMAIN\AdministratorAD_PASSWORD
AD_BASE
: e.g. ou=test,dc=your,dc=domain
Only then it will run your tests. See the activedirectory test helper.
All tests will run within the given AD_BASE
path.