Improve error message (#132)
parent
cf55f1c921
commit
6838fda7a4
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,7 @@
|
|||
import Input from './input';
|
||||
|
||||
jest.mock('./unity-version-parser');
|
||||
|
||||
describe('Input', () => {
|
||||
describe('getFromUser', () => {
|
||||
it('does not throw', () => {
|
||||
|
|
|
@ -17,7 +17,9 @@ class UnityVersionParser {
|
|||
static read(projectPath) {
|
||||
const filePath = path.join(projectPath, 'ProjectSettings', 'ProjectVersion.txt');
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return 'auto';
|
||||
throw new Error(
|
||||
`Project settings file not found at "${filePath}". Have you correctly set the projectPath?`,
|
||||
);
|
||||
}
|
||||
return UnityVersionParser.parse(fs.readFileSync(filePath, 'utf8'));
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ describe('UnityVersionParser', () => {
|
|||
});
|
||||
|
||||
describe('read', () => {
|
||||
it('does not throw', () => {
|
||||
expect(() => UnityVersionParser.read('')).not.toThrow();
|
||||
it('throws for invalid path', () => {
|
||||
expect(() => UnityVersionParser.read('')).toThrow(Error);
|
||||
});
|
||||
|
||||
it('reads from unity-project-with-correct-tests', () => {
|
||||
|
|
Loading…
Reference in New Issue