Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,48 +213,6 @@ jobs:
if: steps.retry.outcome == 'failure'
run: ${{ matrix.cmd }}

# Run the integration, find and mapreduce tests using pouchdb-server as the
# remote adapter. This checks that pouchdb-server works with the current
# PouchDB source tree. We run this on Node.js and on every target browser.
# Running against different versions of Node.js might require splitting this
# out into a distinct job.

pouchdb-server:
needs: lint
strategy:
fail-fast: false
matrix:
client: ['node', 'firefox', 'chromium', 'webkit']
cmd:
- npm test
- TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test
- TYPE=mapreduce ADAPTERS=http npm test
runs-on: ubuntu-latest
env:
CLIENT: ${{ matrix.client }}
SERVER: pouchdb-server
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/install-node-package
with:
node-version: ${{ env.NODE_VERSION }}
- if: ${{ matrix.client != 'node' }}
uses: ./.github/actions/install-playwright
- uses: ./.github/actions/build-pouchdb
- id: test
run: ${{ matrix.cmd }}
continue-on-error: true
- name: First retry
id: retry
if: steps.test.outcome == 'failure'
run: ${{ matrix.cmd }}
continue-on-error: true
- name: Second retry
if: steps.retry.outcome == 'failure'
run: ${{ matrix.cmd }}

# Run all the other testing tasks -- unit tests, and so on. These should be
# run on every version of Node.js that we support.

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ lib_unit
src_browser/
tests/integration/utils-bundle.js
*.heapsnapshot
/pouchdb-server-install
package-lock.json
yarn.lock
/.eslintcache
Expand Down
13 changes: 0 additions & 13 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,9 @@ following values:
- `pouchdb-express-router` (default): a minimal implementation of the CouchDB
API that supports the replication protocol but not the `query()` or `find()`
methods.
- `pouchdb-server`: this is a full reimplementation of the CouchDB API on top of
PouchDB, including Mango and map-reduce queries.
- `couchdb-master`: use this value if you already have CouchDB running; it
causes `COUCH_HOST` to be set to the correct value.

#### `SKIP_MIGRATION` (default: `0`)

Set this to `1` to skip the migration tests.

#### `VIEW_ADAPTERS` (default: `memory`)

Comma-separated list of preferred view adapter backends that PouchDB will use.
Expand Down Expand Up @@ -199,13 +193,6 @@ setting `ADAPTERS=http` and pointing `COUCH_HOST` at our server:

$ TYPE=mapreduce ADAPTERS=http COUCH_HOST='<your CouchDB URL>' npm test

And we test [pouchdb-server](https://github.com/pouchdb/pouchdb-server) using
the current PouchDB source tree. This is an implementation of the CouchDB API
and supports the `find()` and `query()` methods. Run the test suites against it
like so:

$ TYPE=mapreduce ADAPTERS=http SERVER=pouchdb-server npm test

Note that the default choice for the `SERVER` value (`pouchdb-express-router`)
does not support `find` or `mapreduce` and does not need to pass these tests.

Expand Down
65 changes: 2 additions & 63 deletions bin/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,6 @@ fi
: "${VIEW_ADAPTERS:=memory}"
export VIEW_ADAPTERS

pouchdb-setup-server() {
# in CI, link pouchdb-servers dependencies on pouchdb
# modules to the current implementations
if [ -d "pouchdb-server-install" ]; then
rm -rf pouchdb-server-install
fi
mkdir pouchdb-server-install
cd pouchdb-server-install
npm init -y
npm install pouchdb-server
cd ..

for pkg in packages/node_modules/* ; do
pouchdb-link-server-modules "$(basename "$pkg")"
done

TESTDIR=./tests/pouchdb_server
rm -rf $TESTDIR && mkdir -p $TESTDIR
FLAGS=("$POUCHDB_SERVER_FLAGS" --dir "$TESTDIR")
echo -e "Starting up pouchdb-server with flags: ${FLAGS[*]} \n"
./pouchdb-server-install/node_modules/.bin/pouchdb-server -n -p 6984 "${FLAGS[@]}" &
export SERVER_PID=$!
}

pouchdb-link-server-modules() {
local pkg="$1"

cd "packages/node_modules/${pkg}"
npm link
cd ../../../pouchdb-server-install/

# node_modules of pouchdb-server-install
if [ -d "node_modules/${pkg}" ]; then
echo -e "\nnpm link ${pkg} for pouchdb-server-install"
npm link "${pkg}"
fi

# internal node_modules of other packages
for subPkg in node_modules/**/node_modules/"$pkg"; do
cd "$subPkg/../.."
echo -e "\nnpm link ${pkg} for ${subPkg}"
npm link "${pkg}"
cd ../..
done

cd ..
}

search-free-port() {
EXPRESS_PORT=3000
while (: < /dev/tcp/127.0.0.1/$EXPRESS_PORT) 2>/dev/null; do
Expand All @@ -87,14 +39,7 @@ if [[ $CI = true ]] && [[ $CLIENT != node ]]; then
fi

if [[ -n $SERVER ]]; then
if [ "$SERVER" == "pouchdb-server" ]; then
export COUCH_HOST='http://127.0.0.1:6984'
if [[ -n "$GITHUB_REPOSITORY" || "$COVERAGE" == 1 ]]; then
pouchdb-setup-server
else
echo -e "pouchdb-server should be running on $COUCH_HOST\n"
fi
elif [ "$SERVER" == "couchdb-master" ]; then
if [ "$SERVER" == "couchdb-master" ]; then
if [ -z $COUCH_HOST ]; then
export COUCH_HOST="http://127.0.0.1:5984"
fi
Expand All @@ -104,14 +49,8 @@ if [[ -n $SERVER ]]; then
node ./tests/misc/pouchdb-express-router.js &
export SERVER_PID=$!
export COUCH_HOST="http://127.0.0.1:${PORT}"
elif [ "$SERVER" == "express-pouchdb-minimum" ]; then
pouchdb-build-node
node ./tests/misc/express-pouchdb-minimum-for-pouchdb.js &
export SERVER_PID=$!
export COUCH_HOST='http://127.0.0.1:3000'
else
# I mistype pouchdb-server a lot
echo -e "Unknown SERVER $SERVER. Did you mean pouchdb-server?\n"
echo -e "Unknown SERVER $SERVER.\n"
exit 1
fi
fi
Expand Down
1 change: 0 additions & 1 deletion bin/test-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const qs = {
viewAdapters: process.env.VIEW_ADAPTERS,
autoCompaction: process.AUTO_COMPACTION,
SERVER: process.env.SERVER,
SKIP_MIGRATION: process.env.SKIP_MIGRATION,
srcRoot: process.env.SRC_ROOT,
src: process.env.POUCHDB_SRC,
useMinified: process.env.USE_MINIFIED,
Expand Down
6 changes: 3 additions & 3 deletions docs/adapters.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ Currently PouchDB has full support for:
* CouchDB 2.x ([tested in CI](https://github.com/pouchdb/pouchdb/actions))
* CouchDB 3.x ([tested in CI](https://github.com/pouchdb/pouchdb/actions))
* [Cloudant](https://cloudant.com/) (roughly the same as 2.x)
* [PouchDB Server](https://github.com/pouchdb/pouchdb-server) ([tested in CI](https://github.com/pouchdb/pouchdb/actions))
* [PouchDB Server --in-memory mode](https://github.com/pouchdb/pouchdb-server)

[Drupal 8](http://wearepropeople.com/blog/a-content-staging-solution-for-drupal-8-and-more) has also announced support for PouchDB, and there is [rcouch](https://github.com/rcouch/rcouch) as well, but these are both untested by PouchDB.

Expand All @@ -189,12 +187,14 @@ If you are ever unsure about a server, consider replicating from PouchDB to Couc

[PouchDB Server](https://github.com/pouchdb/pouchdb-server) is a standalone REST server that implements the CouchDB API, while using a LevelDB-based PouchDB under the hood. It also supports an `--in-memory` mode and any [LevelDOWN][] adapter, which you may find handy.

PouchDB Server passes the PouchDB test suite at 100%, but be aware that it is not as full-featured or battle-tested as CouchDB.
PouchDB Server is not currently maintained, so it is not currently supported or tested against in this repository.

#### PouchDB Express

The underlying module for PouchDB Server, [Express PouchDB](https://github.com/pouchdb/express-pouchdb) is an Express submodule that mimics most of the CouchDB API within your Express application.

Like PouchDB Server above, this module is not currently maintained, so it is not currently supported or tested against in this repository.

{% include anchor.html title="More resources" hash="more_resources"%}

The best place to look for information on which browsers support which databases is [caniuse.com](http://caniuse.com). You can consult their tables on browser support for various backends:
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function todoBlurred(todo, event) {

{% include anchor.html class="h3" title="Installing CouchDB" hash="installing_couchdb" %}

Now we'll implement the syncing. You need to have a compatible server instance. You can install either [PouchDB-Server](https://github.com/pouchdb/pouchdb-server), [CouchDB](http://couchdb.apache.org/) or use an hosted Couch service such as [Cloudant](https://cloudant.com/)
Now we'll implement the syncing. You need to have a compatible server instance. You can either install [CouchDB](http://couchdb.apache.org/) or use an hosted Couch service such as [Cloudant](https://cloudant.com/)

{% include anchor.html class="h3" title="Enabling CORS" hash="enabling_cors" %}

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"publish-site": "./bin/publish-site.sh",
"build-site": "node ./bin/build-site.js",
"test-coverage": "./bin/test-coverage.sh",
"coverage": "COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find ./bin/test-coverage.sh",
"coverage": "COVERAGE=1 POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find ./bin/test-coverage.sh",
"report-coverage": "npm run test-coverage && istanbul-coveralls --no-rm",
"build-test": "npm run build-test-utils && npm run build-perf",
"build-test-utils": "browserify tests/integration/utils.js > tests/integration/utils-bundle.js",
Expand Down Expand Up @@ -73,7 +73,6 @@
"derequire": "2.1.1",
"eslint": "8.7.0",
"express": "4.17.0",
"express-pouchdb": "4.2.0",
"find-requires": "1.0.0",
"glob": "7.1.5",
"http-server": "0.12.3",
Expand Down
6 changes: 1 addition & 5 deletions tests/integration/browser.migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ describe('migration', function () {
var isNodeWebkit = typeof window !== 'undefined' &&
typeof process !== 'undefined';

var skipMigration = 'SKIP_MIGRATION' in testUtils.params() &&
testUtils.params().SKIP_MIGRATION;

if (!usingDefaultPreferredAdapters() || window.msIndexedDB ||
isNodeWebkit || skipMigration) {
if (!usingDefaultPreferredAdapters() || window.msIndexedDB || isNodeWebkit) {
skip = true;
return this.skip();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test.attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -2064,7 +2064,7 @@ adapters.forEach(function (adapter) {
err.status.should.equal(400);
const body = await err.json();
body.reason.should.equal('_local documents do not accept attachments.');
} else if (serverType === 'pouchdb-express-router' || serverType === 'express-pouchdb') {
} else if (serverType === 'pouchdb-express-router') {
err.status.should.equal(404);
const body = await err.json();
body.reason.should.equal('missing');
Expand All @@ -2090,7 +2090,7 @@ adapters.forEach(function (adapter) {

if (serverType === 'couchdb') {
should.not.exist(doc._attachments);
} else if (serverType === 'pouchdb-express-router' || serverType === 'express-pouchdb') {
} else if (serverType === 'pouchdb-express-router') {
doc._attachments['foo.txt'].content_type.should.equal('text/plain');
JSON.parse(decodeBase64(doc._attachments['foo.txt'].data)).should.deep.equal({
error: 'not_found',
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,13 @@ testUtils.isCouchDB = function (cb) {
PouchDB.fetch(url, options).then(function (response) {
return response.json();
}).then(function (res) {
cb('couchdb' in res || 'express-pouchdb' in res);
cb('couchdb' in res);
});
};

testUtils.getServerType = async () => {
const knownServers = [
'couchdb',
'express-pouchdb',
'pouchdb-express-router',
];

Expand Down
8 changes: 0 additions & 8 deletions tests/misc/express-pouchdb-minimum-for-pouchdb.js

This file was deleted.