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

This modifications fix the use of regex with glob on windows. #89

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 0 additions & 4 deletions lib/blizzard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ Blizzard.prototype.createSession = function (socket, instigator) {
* @protected
*/
Blizzard.prototype.onClientUpgrade = function (cb, req, socket) {
//this.emit("connect", socket);
cb(null, this.createSession(socket, true));
};

Expand All @@ -85,9 +84,6 @@ Blizzard.prototype.onClientUpgrade = function (cb, req, socket) {
* @protected
*/
Blizzard.prototype.serverUpgrade = function (req, socket) {
// console.log("Recieved upgrade.");
// console.log("Headers =", req.headers);

var self = this,
version = req.headers["sec-blizzard-version"];

Expand Down
3 changes: 2 additions & 1 deletion lib/hub/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var TestSpecification = require("./test-specification");
var TestServer = require("./http/test-server");

var WebDriverCollection = require("./webdriver-collection");
var path = require('path');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use double-quotes. Thank you!


/**
* A Batch represents a collection of tests on the Hub.
Expand Down Expand Up @@ -319,7 +320,7 @@ Batch.prototype.handleFileRequest = function (server, agentId, filename) {
}

fileInBatch = batch.spec.tests.some(function (test) {
return test === filename;
return path.normalize(test) === path.normalize(filename);
});

this.getFile(filename, function (err, buffer) {
Expand Down
3 changes: 1 addition & 2 deletions lib/hub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var Hub = module.exports = function Hub(options) {

this._setupEvents();

this.mountpoint = "/";
this.mountpoint = '/';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


this.webdriver = options.webdriver;
};
Expand Down Expand Up @@ -271,7 +271,6 @@ Hub.prototype._onTowerConnection = function (socket) {

client.on("register", function (message) {
var id = message.agentId;

if (!id || id === "undefined") {
client.emit("error", "ID required");
}
Expand Down
3 changes: 2 additions & 1 deletion lib/hub/null-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
var util = require("util");

var Test = require("./test");
var path = require('path');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


/**
* NullTest represents the absence of a Test.
Expand Down Expand Up @@ -34,7 +35,7 @@ util.inherits(NullTest, Test);
* @return {String} Relative URL for the capture page, relative to the mountpoint.
*/
NullTest.prototype.getUrlForAgentId = function (agentId) {
return this.mountpoint + "agent/" + agentId;
return this.mountpoint + "agent" + path.sep + agentId;
};

/**
Expand Down
7 changes: 4 additions & 3 deletions lib/hub/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";

var path = require('path');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

/**
* @module test
*/
Expand Down Expand Up @@ -34,9 +35,9 @@ function Test(options) {
*/
Test.prototype.getUrlForAgentId = function (agentId) {
var url = this.mountpoint;
url += "agent/" + agentId;
url += "/batch/" + this.batchId;
url += "/test/" + this.location;
url += "agent" + path.sep + agentId;
url += path.sep + "batch" + path.sep + this.batchId;
url += path.sep + "test" + path.sep + this.location;
if (this.query) { url += "?" + this.query; }
return url;
};
Expand Down
6 changes: 3 additions & 3 deletions lib/hub/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
var Test = require("./test");
var LiteralTest = require("./literal-test");
var NullTest = require("./null-test");
var path = require('path');

/**
* Tests represent a collection of Test objects.
Expand Down Expand Up @@ -47,9 +48,9 @@ Tests.prototype.getByUrl = function (url) {
location;

for (; index < length; index += 1) {
location = locations[index];
location = path.normalize(locations[index]);

if (url.indexOf(location) !== -1) {
if (path.normalize(url).indexOf(location) !== -1) {
return this.children[location];
}
}
Expand Down Expand Up @@ -114,7 +115,6 @@ Tests.prototype.initializeFromSpecification = function (spec) {
options.query = spec.query;
options.mountpoint = self.mountpoint;
}

self.children[location] = new TestCtor(options);
});
};
Expand Down
12 changes: 7 additions & 5 deletions lib/hub/url-builder.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
"use strict";

var path = require('path');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


module.exports = function makeURLFromComponents(mountpoint, agentId, batchId, test) {
var url = mountpoint;

if (url !== "/") {
if (url !== path.sep) {
// XXX So hacky.
url += "/";
url += path.sep;
}

url += "agent/" + agentId;
url += "agent" + path.sep + agentId;

if (test && batchId) {
// XXX if test is true,
// batchId should always be set
url += "/batch/" + batchId;
url += "/test/" + test;
url += path.sep + "batch" + path.sep + batchId;
url += path.sep + "test" + path.sep + test;
}

return url;
Expand Down