Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
Merge PRs 1548 + 1550, pull e2e tests out into separate build (#1552)
Browse files Browse the repository at this point in the history
* comment out the exit

* Move the PouchDB adapter plugin loading into the modules that need it

* Pull out e2e tests into separate Travis build

* Comment out e2e tests
  • Loading branch information
Simon Stone authored and Liam Grace committed Jul 13, 2017
1 parent 36ddbf6 commit 37de3c5
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ matrix:
- env: SYSTEST=embedded,proxy,web FC_TASK=systest
- env: SYSTEST=hlf FC_TASK=systest
- env: SYSTEST=hlfv1_tls FC_TASK=systest
# - env: SYSTEST=e2e FC_TASK=systest
dist: trusty
addons:
apt:
Expand Down
4 changes: 2 additions & 2 deletions .travis/before-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ then
if [ "${FC_TASK}" != "docs" ]; then
# echo "ABORT_BUILD=true" > ${DIR}/build.cfg
# echo "ABORT_CODE=0" >> ${DIR}/build.cfg
echo 'Docs only build - no pointing bothering with anything more'
exit 0
echo 'Docs only build'
# exit 0
fi

else
Expand Down
6 changes: 6 additions & 0 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ if [ "${DOCS}" != "" ]; then
npm run linkcheck:unstable
fi

# Are we running playground e2e tests?
elif [ "${SYSTEST}" = "e2e" ]; then

# Run the playground e2e tests.
cd "${DIR}/packages/composer-playground"
npm run e2e:main

# Are we running system tests?
elif [ "${SYSTEST}" != "" ]; then
Expand Down
3 changes: 1 addition & 2 deletions packages/composer-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
"server": "npm run server:dev",
"start:hmr": "npm run server:dev:hmr",
"start": "npm run server:dev",
"test:unit": "karma start ./config/karma.conf.js",
"test": "npm run test:unit && npm run e2e:main",
"test": "karma start ./config/karma.conf.js",
"tslint": "tslint",
"typedoc": "typedoc",
"version": "npm run build",
Expand Down
3 changes: 3 additions & 0 deletions packages/composer-runtime-embedded/lib/embeddeddataservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const Logger = require('composer-common').Logger;

const LOG = Logger.getLog('EmbeddedDataService');

// Install the PouchDB plugins. The order of the adapters is important!
PouchDBDataService.registerPouchDBPlugin(require('pouchdb-adapter-memory'));

/**
* Base class representing the data service provided by a {@link Container}.
* @protected
Expand Down
1 change: 1 addition & 0 deletions packages/composer-runtime-embedded/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"composer-runtime-pouchdb": "^0.9.2",
"debug": "^2.6.2",
"istanbul-lib-instrument": "^1.7.2",
"pouchdb-adapter-memory": "^6.2.0",
"request": "^2.81.0",
"uuid": "^3.0.1"
},
Expand Down
13 changes: 10 additions & 3 deletions packages/composer-runtime-pouchdb/lib/pouchdbdataservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ const PouchDBUtils = require('./pouchdbutils');
const LOG = Logger.getLog('PouchDBDataService');

// Install the PouchDB plugins. The order of the adapters is important!
PouchDB.plugin(require('pouchdb-adapter-idb'));
PouchDB.plugin(require('pouchdb-adapter-websql'));
PouchDB.plugin(require('pouchdb-adapter-memory'));
PouchDB.plugin(require('pouchdb-find'));

// This is the object type used to form composite keys for the collection of collections.
Expand All @@ -38,6 +35,16 @@ const collectionObjectType = '$syscollections';
*/
class PouchDBDataService extends DataService {

/**
* Register the specified PouchDB plugin with PouchDB.
* @param {*} plugin The PouchDB plugin to register.
*/
static registerPouchDBPlugin(plugin) {
// No logging here as this is called during static initialization
// at startup, and we don't want to try and load the logger yet.
PouchDB.plugin(plugin);
}

/**
* Create a new instance of PouchDB.
* @param {string} name The name of the PouchDB database.
Expand Down
3 changes: 0 additions & 3 deletions packages/composer-runtime-pouchdb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
"composer-runtime": "^0.9.2",
"debug": "^2.6.2",
"istanbul-lib-instrument": "^1.7.2",
"pouchdb-adapter-idb": "^6.2.0",
"pouchdb-adapter-memory": "^6.2.0",
"pouchdb-adapter-websql": "^6.2.0",
"pouchdb-collate": "^6.2.0",
"pouchdb-core": "^6.2.0",
"pouchdb-find": "^6.2.0",
Expand Down
14 changes: 14 additions & 0 deletions packages/composer-runtime-pouchdb/test/pouchdbdataservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ describe('PouchDBDataService', () => {
return dataService.destroy();
});

describe('#registerPouchDBPlugin', () => {

beforeEach(() => {
sandbox.stub(PouchDB, 'plugin');
});

it('should register a PouchDB plugin', () => {
PouchDBDataService.registerPouchDBPlugin({ foo: 'bar' });
sinon.assert.calledOnce(PouchDB.plugin);
sinon.assert.calledWith(PouchDB.plugin, { foo: 'bar' });
});

});

describe('#createPouchDB', () => {

beforeEach(() => {
Expand Down
4 changes: 4 additions & 0 deletions packages/composer-runtime-web/lib/webdataservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const Logger = require('composer-common').Logger;

const LOG = Logger.getLog('WebDataService');

// Install the PouchDB plugins. The order of the adapters is important!
PouchDBDataService.registerPouchDBPlugin(require('pouchdb-adapter-idb'));
PouchDBDataService.registerPouchDBPlugin(require('pouchdb-adapter-websql'));

/**
* Base class representing the data service provided by a {@link Container}.
* @protected
Expand Down
2 changes: 2 additions & 0 deletions packages/composer-runtime-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
"composer-common": "^0.9.2",
"composer-runtime": "^0.9.2",
"composer-runtime-pouchdb": "^0.9.2",
"pouchdb-adapter-idb": "^6.2.0",
"pouchdb-adapter-websql": "^6.2.0",
"uuid": "^3.0.1",
"xhr": "^2.4.0"
}
Expand Down

0 comments on commit 37de3c5

Please sign in to comment.