Closed rossknudsen closed 4 years ago
So ... I don't know how either the TypeScript and Babel parsers in this package would handle a test without a callback, but I since I can't find any reference to the "declaration exception" in this package or your extension I don't think your immediate issue is with this package.
I've had a quick look and found "declaration exception" in the Jasmine test runner in facebook/jest. It throws an Error. You'll also find the error that's reported on when you run Jest on the console in that file: https://github.com/facebook/jest/blob/d7a7b4294a4507030f86fe4f78e1790f53d0bda9/packages/jest-jasmine2/src/jasmine/Env.ts#L545-L549
Does that help? I'd suggest doing a code read to find out why you'd end up throwing two separate errors depending on how it's called from your extension. You might get some insight running Jest and your extension with some breakpoints set or pausing on exceptions thrown. Good luck!
--
Are you OK if we close the issue here?
Hey, thanks for the thoughts. I did find the encountered a declaration exception string in the Jest source. It seems that it it will output this message irrespective of whether the name of the test is available or not. I'll raise the issue there and see whether it is "by design" or whether they would accept returning the name of the test if it is available.
Doesn't seem like you opened up an issue, but happy to take a PR including the name of the test in the error 👍
Doesn't seem like you opened up an issue, but happy to take a PR including the name of the test in the error 👍
Sorry, yes I was trying to get to the bottom of the problem and raise a PR for it. Hopefully soon!
Issue raised in Jest: facebook/jest#9515
I wrote the following test:
Notice that it is missing the implementation for the test (the second argument). Running Jest on the console I get the following output:
Notice how the name of the test is lost and
jest-editor-support
returns the test name as "encountered a declaration exception" rather than "test with missing callback" - which causes an error in my extension. Since the Jest output appears to be incorrect, it may be that the error is in that package instead of here. Let me know if you think I should file a bug there instead.