Closed aciccarello closed 3 years ago
I agree the parser should not throw an error in this case. However, not sure about using the "name" property to signal for the name... Is this a generic pattern documented somewhere?
But at the minimal, instead of throwing an error, we can change the "default" to log a warning then return a "unknown" marker so it will not "block" the rest of the logic, as the test "name" is not necessarily a "must-have" for all callers...
@aciccarello feel free to take a look at PR #57
@connectdotz Thanks for taking a look and putting together a PR. I think avoiding an error is a good start to prevent it failing the whole file.
Unfortunately for vscode-jest-runner
that won't allow running function.name blocks. It's a pattern I use, but I understand if you consider that unsupported.
Using the function.name property in describe blocks is a pattern to allow refactoring to update test names automatically. However this fails the babel parser for jest-editor-support with a "TypeError: failed to update namedBlock" error.
Since this is a simple enough expression to parse, I would like to see jest-editor-support look at the member expression for a identifier property with a name of "name" and then return the name as the object name.
Inserted at src/parsers/babel_parser.js#L46:
This issue blocks firsttris/vscode-jest-runner#129