Closed maplion closed 4 years ago
Could you please change your project to use our automatic configuration feature to see if that fixes your problem?
It looks like you may also be running in an nx/nrwl mono-repo, in which case, please also read our updated docs on nx/nrwl.
Also, is there any way you could share the src/app/shared/navigation/components/search-card-expand-button/search-card-expand-button.component
file with us (here or via hello@wallabyjs.com email)? From the code snippet it looks like it's not commented out, but we'll need full content to investigate.
@ArtemGovorov This has been sent. @smcenlly I don't really have problems with the current config; is there an advantage to the automatic config?
Also, I read the updated docs on nx/nrwl and I'm not sure I follow how to make that relevant in that other than this edge case, Wallaby has been working fine after my initial setup (and Jest works from command line as well).
This has been sent.
Thanks for sending through your sample. We have isolated the problem to ngx-wallaby-jest
. The ngx-wallaby-jest
package does not take into account when a file (or parts of a file) are commented out.
The ngx-wallaby-jest
is not maintained by the wallaby team and is a community maintained plugin. You may like to raise an issue, or else contribute a fix? We made a brief attempt to fix the issue but realized that the fix may be quite involved with edge cases, inline/block comments and the need to maintain character and line positions.
I don't really have problems with the current config; is there an advantage to the automatic config?
If everything is working for you "as is" with your current configuration, then you do not need to update (although we do think it's a good idea). One limitation right now is obviously that you will not be able to comment out your component files. A couple of things to consider:
1) You only need to maintain your test configuration in one place. If Wallaby works without a configuration file, why have the overhead of an additional/unnecessary configuration file?
2) When you create a wallaby configuration file, you are effectively defining the Wallaby runtime environment, adjusting the configuration to be as close to jest
as possible. When you use automatic configuration, wallaby runs using the same runtime as if you were testing natively in jest
. This can often times speed up your test execution and will also fix problems like the one you described above.
In your case, if you were to use automatic configuration, the jest-preset-angular
will set astTransformers that are used by ts-jest
when it starts the TypeScript compiler that performs the same task that ngx-wallaby-jest
is failing to do when your file is commented. When you use a wallaby configuration file, ts-jest
is not able to be used because Wallaby needs to take control of TypeScript compilation to maintain correct line mappings. This limitation does not exist with automatic configuration and ts-jest
can and will be used just as if you were running with jest.
--
Please let us know if you switch to using automatic configuration and have problems, we're happy to help.
@smcenlly Thank you for the detailed explanation. If I understand what you're saying correctly, with the automatic configuration, besides the other added benefits, I should be able to do away with the need for the ngx-wallaby-jest?
On Wed, Nov 20, 2019, 9:44 PM Simon McEnlly notifications@github.com wrote:
This has been sent.
Thanks for sending through your sample. We have isolated the problem to ngx-wallaby-jest. The ngx-wallaby-jest package does not take into account when a file (or parts of a file) are commented out.
The ngx-wallaby-jest is not maintained by the wallaby team and is a community maintained plugin. You may like to raise an issue https://github.com/bovandersteene/ngx-wallaby-jest/issues, or else contribute a fix? We made a brief attempt to fix the issue but realized that the fix may be quite involved with edge cases, inline/block comments and the need to maintain character and line positions.
I don't really have problems with the current config; is there an advantage to the automatic config?
If everything is working for you "as is" with your current configuration, then you do not need to update (although we do think it's a good idea). One limitation right now is obviously that you will not be able to comment out your component files. A couple of things to consider:
1.
You only need to maintain your test configuration in one place. If Wallaby works without a configuration file, why have the overhead of an additional/unnecessary configuration file? 2.
When you create a wallaby configuration file, you are effectively defining the Wallaby runtime environment, adjusting the configuration to be as close to jest as possible. When you use automatic configuration, wallaby runs using the same runtime as if you were testing natively in jest. This can often times speed up your test execution and will also fix problems like the one you described above.
In your case, if you were to use automatic configuration, the jest-preset-angular will set astTransformers that are used by ts-jest when it starts the TypeScript compiler that performs the same task that ngx-wallaby-jest is failing to do when your file is commented. When you use a wallaby configuration file, ts-jest is not able to be used because Wallaby needs to take control of TypeScript compilation to maintain correct line mappings. This limitation does not exist with automatic configuration and ts-jest can and will be used just as if you were running with jest.
--
Please let us know if you switch to using automatic configuration and have problems, we're happy to help.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wallabyjs/public/issues/2276?email_source=notifications&email_token=ACD7AMJATANHKF7CJF25YTTQUYG3LA5CNFSM4JPZXFZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEY6HLY#issuecomment-556917679, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACD7AMJF6KKZDUX2MENOGBLQUYG3LANCNFSM4JPZXFZQ .
Yes - that is correct.
For completeness, just wanted to mention that I made the changes you recommended and they worked for me. Thanks again.
Issue description or question
"[Error] Postprocessor run failure: Failed to instrument" was happening on an angular component that was commented out (so all pieces: html, scss, ts, were commented out). It shouldn't be parsing commented code; here's the full error:
I solved the problem by deleting the component/removing it from the project, but I don't feel that should be necessary. Reporting this for awareness.
Wallaby diagnostics report