-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f68ead
commit e01e235
Showing
4 changed files
with
50 additions
and
3 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
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,43 @@ | ||
const { expect } = require("chai"); | ||
const { config_from_path, find_local_config } = require("../../../lib/read-config"); | ||
const path = require("path"); | ||
|
||
describe("Get config from path", function() { | ||
it("Report an error if path provided does not exist", function() { | ||
try { | ||
config_from_path("unknow_file"); | ||
} catch (error) { | ||
expect(error).to.be.a("CustomError"); | ||
expect(error) | ||
.to | ||
.have | ||
.property("code", "CLI-02"); | ||
expect(error) | ||
.to | ||
.have | ||
.deep | ||
.property("meta", { | ||
config_path: path.join(process.cwd(), "unknow_file") | ||
}); | ||
} | ||
}); | ||
|
||
it("Report an error when there's no config file in the folder provided", function() { | ||
try { | ||
config_from_path(__dirname); | ||
} catch (error) { | ||
expect(error).to.be.a("CustomError"); | ||
expect(error) | ||
.to | ||
.have | ||
.property("code", "CLI-01"); | ||
expect(error) | ||
.to | ||
.have | ||
.deep | ||
.property("meta", { | ||
config_path: __dirname | ||
}); | ||
} | ||
}); | ||
}); |