Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure directories + set up tests #18

Merged
merged 11 commits into from
Jul 11, 2019
Merged

Restructure directories + set up tests #18

merged 11 commits into from
Jul 11, 2019

Conversation

atepoorthuis
Copy link
Contributor

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:

  • Library now lives in src/ and can be imported directly from there (or through package.json for built version later on)
  • Tests live in test/ with three specific subdirs:
  1. 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 run yarn run dev. Additional examples can be imported in test/sandbox/App.svelte and will be automatically added to the app.
    image
  2. unit/ which contains the jest 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 running yarn run test:unit
  3. integration/ which contains a small app and some example cypress tests. You can run these tests in automatic mode through yarn run test:integration. You can run them in interactive mode by first starting the integration test app yarn run dev:test. Then, in a separate tab run yarn 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 in test/integration/tests/ and the testing app in test/integration/testing-app. Additional test pages/components can be added in test/integration/testing-app/src/App.svelte.
    image

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).

@luucvanderzee luucvanderzee merged commit 06bdb13 into master Jul 11, 2019
@atepoorthuis atepoorthuis deleted the site branch July 23, 2019 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants