Skip to content

Commit

Permalink
Fix file paths to treat every platform equally
Browse files Browse the repository at this point in the history
  • Loading branch information
shinnn committed Feb 1, 2015
1 parent d203c04 commit c9f530d
Show file tree
Hide file tree
Showing 39 changed files with 63 additions and 48 deletions.
4 changes: 2 additions & 2 deletions bin/browser-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var flagWhitelist = ["ghostMode", "reloadOnRestart"];

var cli = meow({
pkg: "../package.json",
help: getHelpText("/../lib/cli/help.txt")
help: getHelpText(path.resolve(__dirname, "../lib/cli/help.txt"))
});

/**
Expand All @@ -32,7 +32,7 @@ handleCli(cli, cmdWhitelist);
function getHelpText(filepath) {
return compile(
fs.readFileSync(
path.resolve(__dirname + filepath),
filepath,
"utf8"
).replace(
"%flags%",
Expand Down
7 changes: 5 additions & 2 deletions test/specs/e2e/e2e.cli.help.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
"use strict";

var assert = require("chai").assert;
var exec = require("child_process").execFile;
var path = require("path");
var exec = require("child_process").exec;

var pkg = require(path.resolve("package.json"));

describe("E2E CLI help test", function () {

var bs;
var chunks = [];

before(function (done) {
bs = exec(__dirname + "/../../../bin/browser-sync.js", function () {
bs = exec("node " + path.resolve(pkg.bin), function () {
bs.kill("SIGTERM");
done();
});
Expand Down
13 changes: 8 additions & 5 deletions test/specs/e2e/e2e.cli.init.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
"use strict";

var assert = require("chai").assert;
var exec = require("child_process").execFile;
var fs = require("fs");
var path = require("path");
var exec = require("child_process").exec;

var pkg = require(path.resolve("package.json"));

describe("E2E CLI init test", function () {

var bs;
var chunks = [];

before(function (done) {
bs = exec(__dirname + "/../../../bin/browser-sync.js", ["init"], function () {
bs = exec("node " + path.resolve(pkg.bin) + " init", function () {
bs.kill("SIGTERM");
done();
});
Expand All @@ -18,9 +22,8 @@ describe("E2E CLI init test", function () {
});
});

after(function () {
var fs = require("fs");
fs.unlinkSync("bs-config.js");
after(function (done) {
fs.unlink("bs-config.js", done);
});

it("creates a config file in cwd", function () {
Expand Down
5 changes: 4 additions & 1 deletion test/specs/e2e/e2e.cli.server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"use strict";

var path = require("path");
var request = require("request");
var assert = require("chai").assert;
var exec = require("child_process").exec;

var pkg = require(path.resolve("package.json"));

describe.skip("E2E CLI server test", function () {

var bs;
Expand All @@ -12,7 +15,7 @@ describe.skip("E2E CLI server test", function () {
before(function (done) {
var count = 0;
var called = false;
bs = exec(["node", __dirname + "/../../../bin/browser-sync.js", "start", "--server", "test/fixtures", "--no-open"].join(" "));
bs = exec(["node", path.resolve(pkg.bin), "start", "--server", "test/fixtures", "--no-open"].join(" "));
bs.stdout.on("data", function (data) {
chunks.push(data);
count += 1;
Expand Down
3 changes: 2 additions & 1 deletion test/specs/e2e/e2e.file.changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var browserSync = require("../../../index");

var path = require("path");
var sinon = require("sinon");
var assert = require("chai").assert;

Expand All @@ -15,7 +16,7 @@ describe("E2E Responding to events", function () {

var config = {
server: {
baseDir: __dirname + "/../../fixtures"
baseDir: path.resolve(__dirname, "../../fixtures")
},
files: ["test/fixtures/assets/*.css"],
logLevel: "silent",
Expand Down
4 changes: 2 additions & 2 deletions test/specs/e2e/e2e.file.watching.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var path = require("path");
var assert = require("chai").assert;

var outpath = path.join(__dirname, "/../../fixtures");
var outpath = path.join(__dirname, "../../fixtures");

describe("file-watching", function () {

Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.online.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;
var sinon = require("sinon");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;
var sinon = require("sinon");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.options.logPrefix.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;
var sinon = require("sinon");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.options.open.browsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var utils = require("../../../lib/utils");

var assert = require("chai").assert;
var sinon = require("sinon");
var browserSync = require("../../../index");
var browserSync = require("../../../");

describe("E2E OPEN Browsers options (1)", function () {

Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.options.scriptpath.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;
var request = require("supertest");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.options.snippet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;
var request = require("supertest");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.proxy.external.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.server.404.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.server.dirs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.server.middleware.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var connect = require("connect");

Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.server.newapi.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var sinon = require("sinon");
var request = require("supertest");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.server.newapi2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var sinon = require("sinon");
var request = require("supertest");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.server.routes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/e2e.server.secure.custom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/files/files.watching.delay.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");
var sinon = require("sinon");
var assert = require("chai").assert;

Expand Down
11 changes: 8 additions & 3 deletions test/specs/files/files.watching.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var path = require("path");
var fs = require("graceful-fs");
var assert = require("chai").assert;

var outpath = path.join(__dirname, "/../../fixtures");
var outpath = path.join(__dirname, "../../fixtures");

var tempFileContent = "A test generated this file and it is safe to delete";

Expand All @@ -29,7 +29,7 @@ describe("File Watcher Module", function () {
it("accepts options for Gaze", function (done) {
var imm = merge({
files: {
"shane": __dirname + "/../../fixtures/test.txt"
"shane": path.resolve(__dirname, "../../fixtures/test.txt")
},
watchOptions: {
debounceDelay: 4000
Expand All @@ -52,7 +52,12 @@ describe("File Watcher Module", function () {

// assert: it works if it calls done
browserSync.reset();
browserSync.create().init({files: tempFile, ui: false, online: false, logSnippet: false}, function (err, bs) {
browserSync.create().init({
files: tempFile,
ui: false,
online: false,
logSnippet: false
}, function (err, bs) {

bs.events.on("file:changed", function (data) {
assert.equal(data.namespace, "core");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/instances/multi.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/instances/multi.plugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var sinon = require("sinon");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/instances/multi.proxy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/instances/single.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/options/options.set.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;

Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/connector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var _ = require("lodash");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/files.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;

Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/hooks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var sinon = require("sinon");
var request = require("supertest");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/logger.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;
var sinon = require("sinon");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");
var BrowserSync = require("../../../lib/browser-sync");

var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/socket.js.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var request = require("supertest");
var http = require("http");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/ui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");
var request = require("supertest");
var Immutable = require("immutable");
var assert = require("chai").assert;
Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/user.plugins.add.middleware.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var assert = require("chai").assert;
var request = require("supertest");
Expand Down
2 changes: 1 addition & 1 deletion test/specs/plugins/user.plugins.cleanup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var browserSync = require("../../../index");
var browserSync = require("../../../");

var sinon = require("sinon");

Expand Down
Loading

0 comments on commit c9f530d

Please sign in to comment.