Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix --config and configPath option (#68)
* Fix --config and configPath option * Add configPath test
- Loading branch information
1 parent
216797e
commit e4baf6d
Showing
2 changed files
with
27 additions
and
0 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
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,23 @@ | ||
'use strict'; | ||
|
||
var test = require('tape'); | ||
var path = require('path'); | ||
var cosmiconfig = require('..'); | ||
|
||
function absolutePath(str) { | ||
return path.join(__dirname, str); | ||
} | ||
|
||
test('options.configPath is respected', function (assert) { | ||
var configPath = absolutePath('fixtures/foo.json'); | ||
var explorer = cosmiconfig('foo', { configPath: configPath }); | ||
explorer.load('./path/does/not/exist').then(function (result) { | ||
assert.deepEqual(result.config, { | ||
foo: true, | ||
}); | ||
assert.equal(result.filepath, configPath); | ||
assert.end(); | ||
}).catch(function (err) { | ||
assert.end(err); | ||
}); | ||
}); |