Please note we have a code of conduct, please follow it in all your interactions with the project.
The core team is monitoring for pull requests. We will review your pull request and either merge it, request changes to it, or close it with an explanation.
Before submitting a pull request, please make sure the following is done:
- Fork the repository and create your branch from main.
- Run
yarn
in the repository root. - If you’ve fixed a bug or added code that should be tested, add tests!
- Ensure the test suite passes (
yarn build && yarn test
).
During the process of developing the library locally we first have to check out the repository and create a branch from main.
git clone https://github.com/hotwired/turbo.git
cd turbo
yarn
git checkout -b '<your_branch_name>'
Once you are done developing the feature or bug fix you have 2 options:
- Run the test suite
- Run a local webserver and checkout your changes manually
The library is tested by running the test suite (found in: src/tests/*
) against headless browsers. The browsers are setup in intern.json
check it out to see the used browser environments.
The tests are using the compiled version of the library and they are themselves also compiled. To compile the tests and library and watch for changes:
yarn watch
To run the tests:
yarn test
Please add your tests in the test files closely related to the feature itself. For example when touching the src/core/drive/page_renderer.ts
your test will probably endup in the src/tests/functional/rendering_tests.ts
.
The html files needed for the tests are stored in: src/tests/fixtures/
To focus on single test grep for it:
yarn test --grep TEST_CASE_NAME
Where the TEST_CASE_NAME
is the name of test you want to run. For example:
yarn test --grep 'triggers before-render and render events'
Since the tests are running in headless browsers it's not easy to debug them easily without using the debugger. Sometimes it's easier to run the supplied webserver and manually click through the test fixtures.
To run the webserver:
yarn start
This requires a build (via yarn build
), or a separate process running yarn watch
.
The webserver is available on port 9000. Since the webserver is run from the root of the project the fixtures can be found using the same path as they have in the project itself, so src/tests/fixtures/rendering.html
makes: http://localhost:9000/src/tests/fixtures/rendering.html
Depending on your operating system you are able to open the page using:
open http://localhost:9000/src/tests/fixtures/rendering.html