mirror of
https://github.com/donl/slouch.git
synced 2026-06-30 06:11:57 -06:00
* doc(readme): clean up reasons * doc(motto) * test(db-and-doc): more coverage * test(create-or-update-ignore-conflict) * test(upsert) * test(ignore-missing) * test(post-and-ignore-conflict) * test(get-merge-put) * refactor(all): rename post and put * test(get-merge-create-or-update) * test(get-merge-update-ignore-conflict) * test(get-merge-upsert) * test(get-modify-upsert) * refactor(doc): redundant code * test(destroy-ignore-conflict) * test(get-and-destroy) * test(mark-as-destroyed) * test(set-destroyed) * refactor(attachment) * test(doc): 100% coverage * test(attachment): create with base 64 * test(attachment): clean up binary code * test(attachment): get * test(attachment): destroy * test(system): is couchdb 1 * test(system): get * test(system): reset * test(updates) * test(updates) * test(all): unique DB names * test(system): reactivate tests * test(user): add role * test(user): downsert role * feat(stream-iterator): indefinite * test(user): 100% coverage * test(request-class) * test(request-class): 100% coverage * test(config) * test(config): more coverage * test(config): more coverage * test(config): 100% coverage * test(all): 100% coverage * refactor(beautify) * test(coverage): enforce 100% * test(system): fix race condition * test(user): shortcut for browser * test(updates): test continuous stream in phantomjs * test(updates): test continuous stream in phantomjs * test(continuous): mock for phantomjs * test(system): abort iterators * test(system): fake abort
1.8 KiB
1.8 KiB
Testing
Set up
Install CouchDB locally. You can easily run CouchDB via docker with:
$ ./run-couchdb-docker.sh
Notes:
- If you are not running ubuntu, you will probably have to configure the
commonvariable - If you are running the tests against a CouchDB instance on another box then you will need to enable CORs, e.g. ./enable-cors.sh and you will also need to change the
hostentry in test/spec/config.json
Resetting the DB
If your DB accumulates a lot of junk data and you want to clear it, you can do so with:
$ npm run reset-db
Warning: this will delete all your databases!
Test in node
This will run the tests in node:
$ npm run node-test
You can also check for 100% code coverage using:
$ npm run node-full-test
You can then view the test coverage by opening cache/coverage/node/lcov-report/index.html in a browser
Run specific tests:
$ npm run node-test -- -- -g 'some reg-ex'
Run specific tests and generate code coverage:
$ npm run node-test -- -- --coverage -g 'some reg-ex'
Manual browser tests
$ npm run browser-server
Use any browser to visit http://127.0.0.1:8001/index.html
And you can filter the tests, e.g. http://127.0.0.1:8001/index.html?grep=reg-ex
Automated browser tests
phantomjs:
$ npm run browser-test-phantomjs
You can also filter the tests, e.g.
$ npm run browser-test-phantomjs -- -g 'some reg-ex'
Chrome:
Note: you must have Chrome installed
$ npm run browser-test-phantomjs -- -b selenium:chrome
Firefox:
Note: you must have Firefox installed
$ npm run browser-test-phantomjs -- -b selenium:firefox
Test in phantomjs, generate code coverage and check for 100% coverage:
$ npm run browser-coverage-full-test
You can then view the test coverage by opening cache/coverage/browser/lcov-report/index.html in any browser