added the browser tests

This commit is contained in:
Spencer Alger
2014-01-15 03:06:56 -07:00
parent 7b967617b5
commit 4c5426c1b4
9 changed files with 44 additions and 24 deletions

View File

@ -10,12 +10,12 @@ matrix:
env: ES_RELEASE=0.90.10 ES_BRANCH=0.90 NODE_UNIT=0
- node_js: "0.10"
env: ES_RELEASE=0.90.9 ES_BRANCH=0.90 NODE_UNIT=0
# - node_js: "0.10"
# env: NODE_UNIT=0 NODE_INTEGRATION=0 TEST_BROWSER='chrome'
# - node_js: "0.10"
# env: NODE_UNIT=0 NODE_INTEGRATION=0 TEST_BROWSER='firefox'
# - node_js: "0.10"
# env: NODE_UNIT=0 NODE_INTEGRATION=0 TEST_BROWSER='ie'
- node_js: "0.10"
env: NODE_UNIT=0 NODE_INTEGRATION=0 TEST_BROWSER=chrome
- node_js: "0.10"
env: NODE_UNIT=0 NODE_INTEGRATION=0 TEST_BROWSER=firefox
- node_js: "0.10"
env: NODE_UNIT=0 NODE_INTEGRATION=0 TEST_BROWSER=ie
exclude:
- node_js: false

View File

@ -2,7 +2,7 @@
# Start or stop a group for travis
#####
function group {
if [ $1 =~ "^start"]; then
if [ $1 =~ "^start" ]; then
echo -e "\n--------- $1"
else
echo -e "--------- $1\n"

View File

@ -65,7 +65,7 @@ _.each([
'Function',
'RegExp'
], function (type) {
var check = _.bindKey(_, 'is' + type);
var check = _['is' + type];
utils['isArrayOf' + type + 's'] = function (arr) {
// quick shallow check of arrays

View File

@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
@ -10,14 +11,14 @@
<script src="mocha.js"></script>
<script>
mocha.setup('bdd');
mocha.checkLeaks();
mocha.globals(['mochaRunner', 'angular']);
// mocha.checkLeaks();
// mocha.globals(['mochaRunner', 'angular']);
</script>
<script src="angular.js"></script>
<script src="angular_build.js"></script>
<script>
mocha.run().on('end', function(){
window.mochaResults = runner.stats;
window.mochaResults = this.stats;
});
</script>
</body>

View File

@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
@ -10,8 +11,8 @@
<script src="mocha.js"></script>
<script>
mocha.setup('bdd');
mocha.checkLeaks();
mocha.globals(['mochaRunner', 'elasticsearch']);
// mocha.checkLeaks();
// mocha.globals(['mochaRunner', 'elasticsearch']);
</script>
<script src="browser_build.js"></script>
<script>

View File

@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
@ -10,8 +11,8 @@
<script src="mocha.js"></script>
<script>
mocha.setup('bdd');
mocha.checkLeaks();
mocha.globals(['mochaRunner', 'jQuery']);
// mocha.checkLeaks();
// mocha.globals(['mochaRunner', 'jQuery']);
</script>
<script src="jquery.js"></script>
<script src="jquery_build.js"></script>

View File

@ -45,7 +45,12 @@ describe('Angular esFactory', function () {
it('returns a new client when it is called', function (done) {
directive(function (esFactory) {
return function () {
expect(esFactory({ log: null })).to.be.a(Client);
try {
var client = esFactory({ log: null });
expect(client).to.have.keys('ping', 'transport', 'indices', 'cluster');
} catch (e) {
return done(e);
}
done();
};
});

View File

@ -25,7 +25,7 @@ describe('Utils', function () {
not: Infinity
},
Function: {
is: [console.error, console.log],
is: [function () {}, function () {}],
},
RegExp: {
is: [/.*/, new RegExp('a')],

View File

@ -2,6 +2,7 @@ var express = require('express');
var http = require('http');
var fs = require('fs');
var _ = require('lodash');
var async = require('async');
var path = require('path');
var root = path.join(__dirname, '../../..');
var glob = require('glob');
@ -15,7 +16,7 @@ var testFiles = 'test/unit/test_!(' + [
'stream_logger',
'tracer_logger',
'transport_with_server',
].join('') + ')*';
].join('|') + ')*';
var defaultFiles = _.map(glob.sync(testFiles), function (filename) {
return path.resolve(root, filename);
@ -28,17 +29,28 @@ var aliasify = require('aliasify').configure({
configDir: root
});
var bundleQueue = async.queue(function (task, done) {
task(done);
}, 1);
function browserBuild(name) {
var files = _.union(defaultFiles, [path.resolve(root, 'test/unit/browser_test_' + name + '_build.js')]);
return function (req, res, next) {
res.set('Content-Type', 'application/javascript');
bundleQueue.push(function (done) {
res.set('Content-Type', 'application/javascript');
var b = browserify(files);
b.transform(aliasify);
b.bundle({
insertGlobals: true
}).pipe(res);
var b = browserify(files);
b.transform(aliasify);
var str = b.bundle({
insertGlobals: true
});
str.pipe(res);
str.on('error', done);
str.on('end', done);
});
};
}