Skip to content

Commit

Permalink
Port tests to karma and set up a CI
Browse files Browse the repository at this point in the history
  • Loading branch information
YurySolovyov committed Jan 30, 2016
1 parent a2080f2 commit a57fc3f
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 5,075 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
.eslintcache
*.log
28 changes: 28 additions & 0 deletions benchmarks/bench.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';

var db;
var onStart = function() {
db = new Dexie('Database');
db.version(1).stores({ people: '++id, firstname, lastname, age' });
db.open();
};

var onComplete = function() {
db.delete();
};

var benchmarkOptions = {
defer: true,
onStart: onStart,
onComplete: onComplete
};

suite('querying', function() {
benchmark('all', function(deferred) {
db.collection('people').find({}).toArray().then(()=> { deferred.resolve() });
}, benchmarkOptions);

benchmark('findOne', function(deferred) {
db.collection('people').findOne({}).then(()=> { deferred.resolve() });
}, benchmarkOptions);
});
29 changes: 29 additions & 0 deletions karma-bench.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = function(config) {
const configuration = {
basePath: './',
frameworks: [
'benchmark'
],
reporters: [
'benchmark'
],

files: [
'src/*.js',
'benchmarks/*.js'
],
port: 9876,
captureTimeout: 10 * 1000,
browserNoActivityTimeout: 10 * 60 * 1000,
colors: true,
browsers: ['Chrome'],
concurrency: Infinity,
plugins: [
'karma-benchmark',
'karma-benchmark-reporter',
'karma-chrome-launcher'
]
};

config.set(configuration);
};
32 changes: 32 additions & 0 deletions karma-test.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = function(config) {
const configuration = {
basePath: './',
frameworks: [
'jasmine',
'jasmine-matchers'
],
reporters: [
'mocha'
],

files: [
'src/*.js',
'tests/spec/**/*.js'
],

port: 9876,
captureTimeout: 10 * 1000,
browserNoActivityTimeout: 10 * 60 * 1000,
colors: true,
browsers: ['Chrome'],
concurrency: Infinity,
plugins: [
'karma-jasmine',
'karma-jasmine-matchers',
'karma-mocha-reporter',
'karma-chrome-launcher'
]
};

config.set(configuration);
};
40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "Dexie-mongoify",
"version": "1.1.0",
"description": "Dexie.js plugin with MongoDB-like API",
"author": {
"name": "Yuri Solovyov"
},
"repository": {
"type": "git",
"url": "https://github.com/YuriSolovyov/Dexie-mongoify"
},

"scripts": {
"test": "node_modules/.bin/karma start karma-test.conf.js --single-run --browsers Chrome",
"bench": "node_modules/.bin/karma start karma-bench.conf.js --single-run --browsers Chrome",
"bench:debug": "node_modules/.bin/karma start karma-bench.conf.js --browsers Chrome"
},
"keywords": [
"mongo",
"indexeddb",
"dexie"
],

"engines": {
"node": ">=4.2 <5.0"
},

"devDependencies": {
"jasmine-core": "^2.3.4",
"benchmark": "^2.1.0",
"karma": "^0.13.19",
"karma-jasmine": "^0.3.6",
"karma-jasmine-matchers": "^0.1.3",
"karma-mocha-reporter": "^1.1.5",
"karma-chrome-launcher": "^0.2.2",
"karma-benchmark": "git+https://github.com/lazd/karma-benchmark.git",
"karma-benchmark-reporter": "git+https://github.com/lazd/karma-benchmark-reporter.git"
},
"license": "MIT"
}
121 changes: 0 additions & 121 deletions tests/lib/jasmine-2.3.4/boot.js

This file was deleted.

Loading

0 comments on commit a57fc3f

Please sign in to comment.