plugin-pug icon indicating copy to clipboard operation
plugin-pug copied to clipboard

Test framework specific warnings

Open SkyaTura opened this issue 4 years ago • 13 comments

Hey @Shinigami92 , I found a (kind of) easy way to test framework warnings. Could you please have a look on this?

By the way, I'm not a TypeScripter myself, so there is some lint errors that I don't know how to fix.

Also, I don't know how to trigger Angular's specific warnings 😂

SkyaTura avatar Apr 04 '21 10:04 SkyaTura

I created this from the add-framework-option branch, I didn't noticed that you've merged that branch until I pushed this.

SkyaTura avatar Apr 04 '21 10:04 SkyaTura

I created this from the add-framework-option branch, I didn't noticed that you've merged that branch until I pushed this.

Yeah it was in this moment ^^

I think you can use git rebase -i main to "fix" this branch And the git push -f

Shinigami92 avatar Apr 04 '21 10:04 Shinigami92

@SkyaTura Or maybe if this doesn't work well, you need git rebase --onto. But for this you should read documentation, cause I don't know exactly myself how it works.

Shinigami92 avatar Apr 04 '21 10:04 Shinigami92

Merge main into the branch works just fine to "fix" it. Although it keeps a lot a commits 😂

SkyaTura avatar Apr 04 '21 10:04 SkyaTura

Yeah with the rebase the commits will go away, you should try it

But for testing the logs we should consider using mocks or spys (https://stackoverflow.com/questions/49096093/how-do-i-test-a-jest-console-log) instead of adding runtime code to the project :thinking:

Shinigami92 avatar Apr 04 '21 10:04 Shinigami92

So I now used git rebase --onto main add-framework-option
You may need to re-checkout the branch on your local machine. Maybe use git branch -D add-framework-option-test-warnings to delete it locally, and then re-checkout.

Shinigami92 avatar Apr 07 '21 14:04 Shinigami92

@SkyaTura I'm looking forward to release a v1.14.0 bundling this feature, the new docs and hopefully also now issue-167 if h0merjam will tackle it :smiley:
Do you have time for addressing and working on the console-mock variant in the next time (maybe over upcoming weekend)?

Shinigami92 avatar Apr 08 '21 17:04 Shinigami92

I can work on it in this weekend, for sure.

SkyaTura avatar Apr 08 '21 18:04 SkyaTura

Hey @Shinigami92 . 👋🏻

I successfully managed to use jest.spyOn to avoid adding runtime code, however, I still don't know what to do to fix those lint errors. 😰

Also, I need someone that actually works with Angular to tell me test cases that throws those warnings, because I wasn't able to reproduce it.

SkyaTura avatar Apr 09 '21 07:04 SkyaTura

Don't fear the linting warnings and errors :smile:
I can fix them in the evening today

You may look into some older issues like these:

https://github.com/prettier/plugin-pug/issues?q=is%3Aissue+label%3A%22framework%3A+Angular%22 https://github.com/prettier/plugin-pug/issues?q=is%3Aissue+log

Shinigami92 avatar Apr 09 '21 07:04 Shinigami92

I managed to add one test case, unfortunately I didn't found examples to the other warnings 😞

SkyaTura avatar Apr 10 '21 03:04 SkyaTura

I managed to add one test case, unfortunately I didn't found examples to the other warnings

Hey, think positive :smiley:
-> You already found one console warning message and that is a good start

I think most of the messages where catched due to reports from using Vue So there where hints to e.g. change pug code to use improved workarounds and that way make your code even better

But I could be false remembering here

I think I will also look into some messages again the next few days and find out how to throw them forcefully in tests

Shinigami92 avatar Apr 10 '21 10:04 Shinigami92

WOW! @SkyaTura I found out that most tests are falling falsely into the default case :confused:
So I think I need to investigate more into it later on what is needed and if the if-cases are not up to date anymore or so :thinking:

But I will do that later, give me some days

Shinigami92 avatar Apr 11 '21 12:04 Shinigami92