Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Babel boilerplate #346

Closed
wants to merge 14 commits into from
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
10 changes: 10 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
["env", {
"targets": {
"node": 0.10
}
}]
],
"plugins": ["transform-runtime"]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.swp
.DS_Store
node_modules
dist
.tern-port
argo-HEAD
argo-jscoverage
Expand Down
16 changes: 15 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@ node_js:
- "0.12"
- "4.1.2"
- "5"
sudo: false
- "6"
env:
global:
- TARGET_NODE_VERSION="6"

script:
- npm install
- npm run build
- |
if [[ "${TRAVIS_NODE_VERSION}" == "${TARGET_NODE_VERSION}" ]]; then
npm test
fi
- cd dist
- ln -s ../node_modules node_modules
- npm test
2 changes: 1 addition & 1 deletion lib/api_resources/servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ServerResource.prototype.subscribe = function(env, next) {
}

var self = this;
parsed = url.parse(env.request.url, true);
var parsed = url.parse(env.request.url, true);
var topic = decodeURIComponent(parsed.query.topic);

if (topic) {
Expand Down
2 changes: 1 addition & 1 deletion lib/event_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ EventSocket.prototype.send = function(topic, data) {
}

try {
data = JSON.stringify(data);
arguments[1] = JSON.stringify(data);
} catch (err) {
console.error('ws JSON.stringify ', err);
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/web_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var WebSocket = module.exports = function(address, httpOptions) {

var self = this;
if (httpOptions) {
for (k in httpOptions) {
for (var k in httpOptions) {
self.options[k] = httpOptions[k];
}
}
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"argo": "^1.0.0",
"argo-formatter-siren": "0.0.0",
"async": "^0.9.0",
"babel-runtime": "^6.23.0",
"calypso": "^1.0.0",
"calypso-level": "^0.5.0",
"calypso-query-decompiler": "^0.4.0",
Expand All @@ -33,13 +34,17 @@
"zetta-streams": "^0.3.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.3.3",
"memdown": "^0.10.2",
"mocha": "^1.20.1",
"portscanner": "^1.0.0",
"supertest": "^0.13.0",
"zetta-cluster": "^6.3.0"
},
"scripts": {
"build": "babel . --out-dir dist --ignore node_modules/,dist/ --copy-files",
"test": "./node_modules/.bin/mocha -R spec",
"coverage": "bin/_coverage",
"tag": "bin/_tag"
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/scout_test_mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ MockPeerRegistry.prototype.add = function(peer, cb) {
MockPeerRegistry.prototype.get = function(id, cb) {
this.peers.forEach(function(peer) {
if (peer.id === id) {
cb(null, JSON.stringify(peer));
cb(null, peer);
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion test/test_event_streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe('Event Streams', function() {
.server('hub', [Driver, Driver], ['cloud'])
.server('hub2', [Driver, Driver], ['cloud'])
.on('ready', function() {
app = cluster.servers['cloud'];
var app = cluster.servers['cloud'];
urls.push('localhost:' + cluster.servers['cloud']._testPort);
urls.push('localhost:' + cluster.servers['hub']._testPort);

Expand Down
1 change: 1 addition & 0 deletions test/test_peer_connection_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ describe('Peer Connection API', function() {
describe('/peer-management update API', function() {
var cloud = null;
var localOne = null;
var localPort = null;
var cloudPort = null;
var localOnePort = null;
var connectionId = null;
Expand Down
8 changes: 4 additions & 4 deletions test/test_peer_registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ describe('Peer Registry', function() {

it('should get peers by id', function(done) {
var reg = new PeerRegistry(opts);
reg.save({ id: 012345 }, function() {
reg.get(012345, function(err, peer) {
reg.save({ id: 12345 }, function() {
reg.get(12345, function(err, peer) {
assert(peer);
done();
});
Expand All @@ -65,7 +65,7 @@ describe('Peer Registry', function() {

it('should delete peers', function(done) {
var reg = new PeerRegistry(opts);
var peer = { id: 0123456 };
var peer = { id: 123456 };
reg.save(peer, function() {
reg.remove(peer, function(err, peer) {
assert.ifError(err);
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('Peer Registry', function() {

it('should update existing peers', function(done) {
var reg = new PeerRegistry(opts);
var peer = { id: 012345 };
var peer = { id: 12345 };

reg.save(peer, function() {
reg.add(peer, function(err, result) {
Expand Down
4 changes: 3 additions & 1 deletion test/test_query_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,10 @@ describe('Zetta Query Api', function() {
});

describe('Non provisioned devices', function() {
var app = null;

beforeEach(function(done) {
machine = Scientist.create(TestDriver);
var machine = Scientist.create(TestDriver);
Scientist.init(machine);
reg.save(machine, function(err) {
assert.ok(!err);
Expand Down
6 changes: 3 additions & 3 deletions test/test_stream_topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ describe('Stream Topic', function() {

describe('.match()', function() {

function matchTest(query, topic, eval) {
it('should return ' + eval + ' for query ' + query + ' on topic ' + topic, function() {
function matchTest(query, topic, eval_) {
it('should return ' + eval_ + ' for query ' + query + ' on topic ' + topic, function() {
var t = StreamTopic.parse(query);
assert.equal(t.match(topic), eval);
assert.equal(t.match(topic), eval_);
})
}

Expand Down