Skip to content

Commit

Permalink
fix: solve the functional test failure caused by app-config
Browse files Browse the repository at this point in the history
  • Loading branch information
RonWang committed Feb 24, 2020
1 parent e4e72e2 commit 5d3053e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/model/abstract-config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const FILE_TYPE_YAML = 'YAML';
const READ_METHOD_BY_FILE_TYPE = {
JSON: (filePath) => {
try {
return JSON.parse(fs.readFileSync(filePath));
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
} catch (error) {
throw new Error(`Failed to parse JSON file ${filePath}.\n${error}`);
}
Expand Down
2 changes: 2 additions & 0 deletions test/functional/commands/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ class ApiCommandBasicTest {
fs.existsSync.callThrough();
sinon.stub(fs, 'readFileSync').withArgs(askCliConfig, 'utf-8').returns(JSON.stringify(this._TEST_DATA.ASK_CONFIG));
fs.readFileSync.callThrough();
sinon.stub(fs, 'accessSync').withArgs(askCliConfig, fs.constants.R_OK | fs.constants.W_OK).returns(true);
fs.accessSync.callThrough();

// Mock http server
// According to input httpClienConfig,
Expand Down

0 comments on commit 5d3053e

Please sign in to comment.