Restructure directories + set up tests #18
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Although this branch is called
site
, I haven't yet finished setting that up yet. To prepare for it, I had to make a couple of pretty significant changes to the directory structure so I think it's good to merge this first. What has changed:src/
and can be imported directly from there (or through package.json for built version later on)test/
with three specific subdirs:sandbox/
which holds examples and a playground for live testing by a human (you - the developer). This is a simple Svelte app (with all the live reload goodies) that gets served when you runyarn run dev
. Additional examples can be imported intest/sandbox/App.svelte
and will be automatically added to the app.unit/
which contains thejest
unit tests. For now these only contain tests for the dataContainer. I think this will mostly be tests for classes or util functions. Our components don't really work in isolation so are better tested through integration test. You can run these by runningyarn run test:unit
integration/
which contains a small app and some examplecypress
tests. You can run these tests in automatic mode throughyarn run test:integration
. You can run them in interactive mode by first starting the integration test appyarn run dev:test
. Then, in a separate tab runyarn run cy:open
. This way you can see the tests run live, replay each step and inspect the browser at any time. It does live-reloading too so if you change the test, the test app or the actual library source code, it updates on the fly. Pretty sweet! Integration tests live intest/integration/tests/
and the testing app intest/integration/testing-app
. Additional test pages/components can be added intest/integration/testing-app/src/App.svelte
.Oh, and importantly, I fixed the error with setting up interactivity that emerged in Svelte >3.6.3 due to a change in the mounting order (see sveltejs/svelte#2281).