-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): find .jflintrc from the current directory all the way up t…
…o the filesystem root
- Loading branch information
Showing
8 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
coverage/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
const CommandLine = require('../../lib/cli'); | ||
const assert = require('assert'); | ||
const os = require('os'); | ||
const path = require('path'); | ||
|
||
describe('CommandLine', function() { | ||
let sut; | ||
|
||
beforeEach(function() { | ||
sut = new CommandLine(process); | ||
}); | ||
|
||
describe('_findConfigPath', function() { | ||
it('should return the directory\'s config path if .jflintrc exists in the directory', function() { | ||
const dir = path.normalize(`${__dirname}/../resources/jflintrc-exist`); | ||
assert(sut._findConfigPath(dir) === path.join(dir, '.jflintrc')); | ||
}); | ||
|
||
it('should return the parent directory\'s config path if .jflintrc exists in the parent directory', function() { | ||
const dir = path.normalize(`${__dirname}/../resources/jflintrc-exist/jflintrc-not-exist`); | ||
const parentDir = path.normalize(`${__dirname}/../resources/jflintrc-exist`); | ||
assert(sut._findConfigPath(dir) === path.join(parentDir, '.jflintrc')); | ||
}); | ||
|
||
it('should return the home directory\'s config path if .jflintrc does not exist from the directory up to the root', function() { | ||
// setup | ||
sut._isFileExist = () => false; | ||
|
||
// exercise & verify | ||
const dir = path.normalize(`${__dirname}`); | ||
assert(sut._findConfigPath(dir) === path.join(os.homedir(), '.jflintrc')); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"jenkinsUrl": "http://jenkins.example.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dummy |