Skip to content

Commit 9c198c4

Browse files
committed
filename is path without name
1 parent f952637 commit 9c198c4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bin/commands/init.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function get_path(args) {
2424
let filename = args._[1];
2525
if (filename !== path.basename(filename)) {
2626
// filename is an absolute path
27-
return filename;
27+
return filename;
2828
}
2929
return path.join(process.cwd(), args._[1]);
3030
}
@@ -39,7 +39,13 @@ module.exports = function init(args) {
3939
if (path_to_json === undefined) return;
4040

4141
// append .json if filename passed is not of json type
42-
if (path.extname(path_to_json) !== ".json") path_to_json += '.json';
42+
if (path.extname(path_to_json) !== '' && path.extname(path_to_json) !== ".json") path_to_json += ".json";
43+
44+
// append browserstack.json if filename is a path without filename
45+
if (path.extname(path_to_json) === '') path_to_json = path.join(path_to_json, "browserstack.json");
46+
47+
console.log(path_to_json);
48+
return path_to_json;
4349

4450
let config = {
4551
file: require('../templates/configTemplate')(),

0 commit comments

Comments
 (0)