-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: nicer error message on bad config file
- Loading branch information
Showing
6 changed files
with
57 additions
and
6 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {; |
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 @@ | ||
{ | ||
"files": [ | ||
} |
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 @@ | ||
files: | ||
- 'a.js' | ||
- 'b.js |
Empty file.
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,39 @@ | ||
import { loadConfigFile } from '../configFile'; | ||
|
||
describe('load config file', () => { | ||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
describe('failure', () => { | ||
test('empty', async () => { | ||
const config = await loadConfigFile('src/cli/__tests__/assets/empty.json'); | ||
|
||
expect(config).toBeUndefined(); | ||
}); | ||
|
||
test('bad format JSON', async () => { | ||
const config = await loadConfigFile('src/cli/__tests__/assets/bad-format.json'); | ||
|
||
expect(config).toBeUndefined(); | ||
}); | ||
|
||
test('bad format YAML', async () => { | ||
const config = await loadConfigFile('src/cli/__tests__/assets/bad-format.yaml'); | ||
|
||
expect(config).toBeUndefined(); | ||
}); | ||
|
||
test('bad format JS', async () => { | ||
const config = await loadConfigFile('src/cli/__tests__/assets/bad-format.js'); | ||
|
||
expect(config).toBeUndefined(); | ||
}); | ||
|
||
test('not found', async () => { | ||
const config = await loadConfigFile('not-found'); | ||
|
||
expect(config).toBeUndefined(); | ||
}); | ||
}); | ||
}); |
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