'React-scripts test: no traceback on exception
I remake browser version of TacticToy game with React, and during unit-tests writing I've got a problem: there is no full traceback of a custom exception, only test function is highlighted:
In the package.json
file's scripts
section I have "test": "react-scripts test"
, it runs Jest under the hood. I tried to run Jest without React-scripts, but this leads to lots of errors, seems like React adds some important config... So, what and how should I adjust to receive tracebacks of exceptions thrown during the tests?
Solution 1:[1]
Thanks to the ESLint, I found the problem source: the code threw exceptions as plain strings, and when I replace it with throw new Error("text")
I receive the stack trace :)
The solution is pretty simple (and it doesn't relate to React nor Jest), strange that I've googled no explanation... Here is a moral: always use a linter!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | AivanF. |