gemini-testing / gemini-testing/testplane
Hard to read errors when unable to parse the config
- Dominant language
- TypeScript
- Stars
- 830
- Forks
- 76
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 14
Description
### Description
Now, for example, if we pass an empty string in an environment variable for a key that implies a boolean value and is parsed through JSON.parse, we get an unreadable error: “Uncaught SyntaxError: Unexpected end of JSON input".
Error should be readable and should include "what variable was it, what value was it"
Probably it should be fixed in https://github.com/gemini-testing/configparser
### Verify latest release
- [x] I verified that the issue exists in the latest Testplane release
### Testplane version
_No response_
### Last Testplane version that worked
_No response_
### Which area(s) of Testplane are affected? (leave empty if unsure)
Configuration
### Link to the code that reproduces this issue or a replay of the bug
_No response_
### Reproduction steps
- Attach any of our plugins (for example, html-reporter)
- Overwrite json value with invalid env variable (for example, html_reporter_enabled)
- `html_reporter_enabled=invalid npx testplane`
### Actual Behavior
We get error like:
```
[13:28:23 +0300] Unhandled Rejection in testplane:master:42579:
Promise: Promise {
SyntaxError: Unexpected token i in JSON at position 0
at parse ()
at /Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/core.js:25:21
at /Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/core.js:68:26
at Object.get [as enabled] (/Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/lazy.js:27:25)
at /Users/kroman512/clean/minimal-testplane/node_modules/lodash/lodash.js:2730:27
at arrayEach (/Users/kroman512/clean/minimal-testplane/node_modules/lodash/lodash.js:530:11)
at baseClone (/Users/kroman512/clean/minimal-testplane/node_modules/lodash/lodash.js:2727:7)
at Function.cloneDeep (/Users/kroman512/clean/minimal-testplane/node_modules/lodash/lodash.js:11156:14)
at forceParsing (/Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/lazy.js:16:14)
at /Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/core.js:105:16
}
Reason: SyntaxError: Unexpected token i in JSON at position 0
at parse ()
at /Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/core.js:25:21
at /Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/core.js:68:26
at Object.get [as enabled] (/Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/lazy.js:27:25)
at /Users/kroman512/clean/minimal-testplane/node_modules/lodash/lodash.js:2730:27
at arrayEach (/Users/kroman512/clean/minimal-testplane/node_modules/lodash/lodash.js:530:11)
at baseClone (/Users/kroman512/clean/minimal-testplane/node_modules/lodash/lodash.js:2727:7)
at Function.cloneDeep (/Users/kroman512/clean/minimal-testplane/node_modules/lodash/lodash.js:11156:14)
at forceParsing (/Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/lazy.js:16:14)
at /Users/kroman512/clean/minimal-testplane/node_modules/html-reporter/node_modules/gemini-configparser/lib/core.js:105:16
```
### Expected Behavior
human-readable error, from which it would be clear that "html_reporter_enabled" env variable value is the issue
### Which Node.js version are you using?
20.11.0
_Internal issue: https://nda.ya.ru/t/4PWRys2Q7JhGvW_
Contributor guide
Assessment
This issue has not been assessed yet.