Skip to content

Commit 35d0dea

Browse files
committed
use path and fix test cases
1 parent 8cf8177 commit 35d0dea

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

bin/commands/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const fileHelpers = require("../helpers/fileHelpers"),
88

99
module.exports = function init(args) {
1010
if (args.p) {
11-
var path_to_bsconf = args.p + "/browserstack.json";
11+
var path_to_bsconf = path.join(args.p + "/browserstack.json");
1212
} else {
1313
var path_to_bsconf = "./browserstack.json";
1414
}

test/unit/bin/commands/init.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const chai = require("chai"),
22
sinon = require("sinon"),
3-
chaiAsPromised = require("chai-as-promised");
3+
chaiAsPromised = require("chai-as-promised"),
4+
util = require("util");
45

56
const Constants = require("../../../../bin/helpers/constants"),
67
logger = require("../../../../bin/helpers/logger").winstonLogger,
@@ -32,6 +33,9 @@ describe("init", () => {
3233
it("fail if given path is not present", () => {
3334
dirExistsStub = sandbox.stub().yields(false);
3435
writeStub = sandbox.stub();
36+
formatStub = sandbox.stub().callsFake(function (args) {
37+
return args;
38+
});
3539

3640
const init = proxyquire("../../../../bin/commands/init", {
3741
"../helpers/utils": {
@@ -41,6 +45,9 @@ describe("init", () => {
4145
dirExists: dirExistsStub,
4246
write: writeStub,
4347
},
48+
"util": {
49+
format: formatStub
50+
}
4451
});
4552

4653
init(args);

0 commit comments

Comments
 (0)