SimonTestNet / SimonTest

Repository for SimonTest questions and issues https://simontest.net
16 stars 2 forks source link

Add option to just see generated code #15

Closed mackelito closed 7 years ago

mackelito commented 7 years ago

When generating test and there is a existing test file we are asked if we want to replace it. It would be nice to have the option to just see the generated test in a new file.

ManuelDeLeon commented 7 years ago

Brainstorm with me. I have a problem with the way overlays work in VSCode, they're too clunky. How about if it gives you the option of saving to a separate file? It could work in one of two ways:

  1. Use .generated and overwrite every time. I like this option. For app.component.ts, if there's already app.component.spec.ts it will create app.component.generated.spec.ts (overwriting it if it exists).
  2. Use an incrementing numeric system without overwriting files: app.component.1.spec.ts, .2.spect.ts, etc.

What do you think? Do you have another option?

mackelito commented 7 years ago

I´m not sure but I think that approach 2 would be a good way to go.. both will run when running tests with angular cli, but using the second approach also allows users to use the test generator to just add more separated tests.

ManuelDeLeon commented 7 years ago

The problem I have with 2 is the very likely possibility of devs either going through the trouble of deleting generated test files or worse, leaving redundant tests around.

mackelito commented 7 years ago

hmm.. not sure I see it as a problem really :P

ManuelDeLeon commented 7 years ago

This is how v0.14.0 works: If there's a .spec.ts file, it will save a .gen.spec.ts one and warn you about it. If there's already a .gen.spec.ts it will ask if you want to replace it. That way you can generate .gen files just to see the changes, incorporate them into the (true) .spec one, then probably delete the .gen.

The reason is that in my experience the first .spec.ts file is just the starting point for testing (the boilerplate if you will). It's a rare component that I generate the test and leave it as it was generated.