Contribution Guide
A great way to contribute to the project is to send a detailed report when you encounter an issue.To make things easier for contributors and maintainers, we use CMTY.
Please make sure to include a reproduction repository or so that bugs can be reproduced without great efforts. The better a bug can be reproduced, the faster we can start fixing it!
Pull Requests
We'd love to see your pull requests, even if it's just to fix a typo!
However, any significant improvement should be associated to an existingor bug report.
- Run or
yarn install
to install the dependencies.
Setup
Before running any tests, make sure all dependencies are met and build all packages:
Test structure
Fixtures
The fixtures (found under ) contain several Nuxt applications. To keep build time as short as possible,we don't build an own Nuxt application per test. Instead, the fixtures are built (yarn test:fixtures
) before runningthe actual unit tests.
Please make sure to alter or add a new fixture when submitting a PR to reflect the changes properly (if applicable).
Also, don't forget to rebuild a fixture after changing it by running the corresponding testwith jest test/fixtures/my-fixture/my-fixture.test.js
!
Unit tests
The unit tests can be found in tests/unit
and will be executed after building the fixtures. A fresh Nuxt server will be usedper test so that no shared state (except the initial state from the build step) is present.
After adding your unit tests, you can run them directly:
Or you can run the whole unit test suite:
Again, please be aware that you might have to rebuild your fixtures before!
To do so you can use the Nuxt script itself to launch for example your fixture or an example app:
Examples
If you are working on a larger feature, please set up an example app in examples/
.This will help greatly in understanding changes and also help Nuxt users to understand the feature you've built in-depth.
Linting
As you might have noticed already, we are using ESLint to enforce a code standard. Please run yarn lint
before committingyour changes to verify that the code style is correct. If not, you can use yarn lint —fix
or npm run lint — —fix
(no typo!) to fix most of thestyle changes. If there are still errors left, you must correct them manually.
If you are adding a new feature, or refactoring or changing the behavior of Nuxt in any other manner, you'll likelywant to document the changes. Please do so with a PR to the repository.You don't have to write documentation up immediately (but please do so as soon as your pull request is mature enough).
Final checklist
When submitting your PR, there is a simple template that you have to fill out.Please tick all appropriate "answers" in the checklists.
Troubleshooting
Debugging tests on macOS
Searching for will reveal it's used to start new Nuxt processes during tests. It's been seen to stop working on macOS at times and may require you to manually set a port for testing.