Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Feature Request: init to include tests stubs #4

Open
jdevera opened this issue Aug 30, 2021 · 3 comments
Open

Feature Request: init to include tests stubs #4

jdevera opened this issue Aug 30, 2021 · 3 comments

Comments

@jdevera
Copy link
Contributor

jdevera commented Aug 30, 2021

I am in the process of hacking the Google Calendar extension to support a custom formatter, and as part of my experimental work, I want to write some tests to limit the extent of the destruction I'd be causing 💥 . This being my first exposure to TS, Jest, and the whole JS dev ecosystem (I come from a world of C++ and python) means I am getting stuck every two steps, but that is to be expected :)

Anyway, I have seen that this repo contains a test and it runs! 😅 but when I have tried to extract the minimal elements that will allow me to run a test on the Gcal extension I have not been successful (yet). This is the motivator for this request. It would be of great help if the init command, together with the other files it generates, could also output a test file and the appropriate config that will make it run.

Some of my ideas around it:

  1. It should import something from the main script, even if dummy
  2. There should be a test in the test file
  3. The test should fail by default (to encourage devs to actually touch the tests)
  4. This should be the default behaviour, but there should be a flag to disable it, e.g. init --no-test

I'm creating this issue to see if you like the idea. I'm happy to contribute the changes if you do. When I figure out how to get that dummy test to run, that is.

@dvargas92495
Copy link
Owner

The only point here where I feel contention is number 4. I have some opinions on tests, one of which is a fear of it slowing down development from getting off the ground, which the init command is meant to shorten as much as possible.

I think I'd prefer this being an add-on option, --with-tests or --tests

@dvargas92495
Copy link
Owner

There's a second concern that came up after I hit enter which is with point 1. Roam extensions don't need to export anything bc they just run in Roam on load. Importing something from the main script means we are now exporting something from the main script when we previously didn't need to, which is the start of writing source code just for the sake of tests. The default should probably be a separate file that exports something that is imported by the main file and the test

@jdevera
Copy link
Contributor Author

jdevera commented Aug 30, 2021

Fair points, and perhaps the desired outcome is to actually not do this at all. If not something that you want to introduce as the main experience, it could be something to live in docs, or a blog post somewhere. In the meantime, I'll try to make at least one test work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants